improve permission handling for quick entry controller (#3081)

This commit is contained in:
Kevin Papst
2022-01-20 22:24:19 +01:00
committed by GitHub
parent 49bb9980b8
commit 97c23f75dd
3 changed files with 75 additions and 20 deletions

View File

@@ -25,7 +25,7 @@ use Symfony\Component\Routing\Annotation\Route;
* Controller used to enter times in weekly form.
*
* @Route(path="/quick_entry")
* @Security("is_granted('weekly_own_timesheet') and is_granted('edit_own_timesheet')")
* @Security("is_granted('quick-entry')")
*/
class QuickEntryController extends AbstractController
{
@@ -45,14 +45,6 @@ class QuickEntryController extends AbstractController
*/
public function quickEntry(Request $request, ?string $begin = null)
{
$mode = $this->timesheetService->getActiveTrackingMode();
if (!$mode->canEditDuration() && !$mode->canEditEnd()) {
$this->flashError('Not allowed');
return $this->redirectToRoute('homepage');
}
$factory = $this->getDateTimeFactory();
if ($begin === null) {
$begin = $factory->createDateTime();