Improve create and start permission handling (#613)

This commit is contained in:
Kevin Papst
2019-03-06 10:24:27 +01:00
committed by GitHub
parent bce85b04d6
commit e260dd84ad
31 changed files with 258 additions and 86 deletions

View File

@@ -33,5 +33,4 @@ interface RoundingInterface
* @param $minutes
*/
public function roundDuration(Timesheet $record, $minutes);
}

View File

@@ -10,7 +10,7 @@
namespace App\Timesheet;
use App\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use App\Security\CurrentUser;
class UserDateTimeFactory
{
@@ -20,18 +20,13 @@ class UserDateTimeFactory
protected $timezone;
/**
* @param TokenStorageInterface $tokenStorage
* @param CurrentUser $user
*/
public function __construct(TokenStorageInterface $tokenStorage)
public function __construct(CurrentUser $user)
{
if (null === $tokenStorage->getToken()) {
return;
}
/* @var $user User */
$user = $tokenStorage->getToken()->getUser();
$timezone = date_default_timezone_get();
$user = $user->getUser();
if ($user instanceof User && null !== $user->getPreferenceValue('timezone')) {
$timezone = $user->getPreferenceValue('timezone');
}