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

@@ -12,11 +12,18 @@ namespace App\Timesheet\TrackingMode;
use App\Entity\Timesheet;
use DateTime;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
final class PunchInOutMode implements TrackingModeInterface
{
use TrackingModeTrait;
public function __construct(
private readonly AuthorizationCheckerInterface $authorizationChecker
)
{
}
public function canEditBegin(): bool
{
return false;
@@ -34,7 +41,7 @@ final class PunchInOutMode implements TrackingModeInterface
public function canUpdateTimesWithAPI(): bool
{
return false;
return $this->authorizationChecker->isGranted('view_other_timesheet');
}
public function create(Timesheet $timesheet, ?Request $request = null): void