API begin and end fields for Admins (#5134)

This commit is contained in:
Kevin Papst
2024-10-25 10:47:58 +02:00
committed by GitHub
parent 31bae44f3c
commit dcc52f1a95
12 changed files with 161 additions and 47 deletions

View File

@@ -13,12 +13,16 @@ use App\Configuration\SystemConfiguration;
use App\Entity\Timesheet;
use DateTime;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
final class DurationFixedBeginMode implements TrackingModeInterface
{
use TrackingModeTrait;
public function __construct(private SystemConfiguration $configuration)
public function __construct(
private readonly SystemConfiguration $configuration,
private readonly AuthorizationCheckerInterface $authorizationChecker
)
{
}
@@ -39,7 +43,7 @@ final class DurationFixedBeginMode implements TrackingModeInterface
public function canUpdateTimesWithAPI(): bool
{
return false;
return $this->authorizationChecker->isGranted('view_other_timesheet');
}
public function create(Timesheet $timesheet, ?Request $request = null): void