Skip to content

Commit 65453d7

Browse files
committed
Internal: Replace Security annotations with IsGranted attributes
1 parent 3658fb9 commit 65453d7

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

src/CoreBundle/Controller/ToolController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1212
use Symfony\Component\HttpFoundation\Response;
1313
use Symfony\Component\Routing\Attribute\Route;
14+
use Symfony\Component\Security\Http\Attribute\IsGranted;
1415

1516
#[Route('/tool')]
1617
class ToolController extends AbstractController
1718
{
1819
/**
1920
* Updates the table tool and resource_type with the content of tools.yml.
20-
*
21-
* @Security("is_granted('ROLE_ADMIN')")
2221
*/
2322
#[Route(path: '/update', methods: ['GET'])]
23+
#[IsGranted('ROLE_ADMIN')]
2424
public function profile(ToolChain $toolChain): Response
2525
{
2626
$toolChain->createTools();

src/LtiBundle/Controller/AdminController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\Routing\Attribute\Route;
19+
use Symfony\Component\Security\Http\Attribute\IsGranted;
1920

20-
/**
21-
* Class AdminController.
22-
*
23-
* @Security("is_granted('ROLE_ADMIN')")
24-
*/
2521
#[Route(path: '/admin/lti')]
22+
#[IsGranted('ROLE_ADMIN')]
2623
class AdminController extends BaseController
2724
{
2825
use ControllerTrait;

src/LtiBundle/Controller/CourseController.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Symfony\Component\HttpFoundation\Response;
3434
use Symfony\Component\Routing\Attribute\Route;
3535
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
36+
use Symfony\Component\Security\Http\Attribute\IsGranted;
3637
use UserManager;
3738

3839
#[Route(path: '/courses/{cid}/lti')] // ;
@@ -373,9 +374,7 @@ public function show(int $id): Response
373374
);
374375
}
375376

376-
/**
377-
* @Security("is_granted('ROLE_TEACHER')")
378-
*/
377+
#[IsGranted('ROLE_TEACHER')]
379378
#[Route(path: '/', name: 'chamilo_lti_configure')]
380379
#[Route(path: '/add/{id}', name: 'chamilo_lti_configure_global', requirements: ['id' => '\d+'])]
381380
public function courseConfigure(?int $id, Request $request): Response
@@ -476,14 +475,8 @@ public function courseConfigure(?int $id, Request $request): Response
476475
);
477476
}
478477

479-
/**
480-
* @Security("is_granted('ROLE_TEACHER')")
481-
*
482-
* @param string $catId
483-
*
484-
* @throws Exception
485-
*/
486478
#[Route(path: '/grade/{catId}', name: 'chamilo_lti_grade', requirements: ['catId' => '\d+'])]
479+
#[IsGranted('ROLE_TEACHER')]
487480
public function grade(int $catId): Response
488481
{
489482
$em = $this->managerRegistry->getManager();

0 commit comments

Comments
 (0)