2828use Pimcore \Bundle \StudioBackendBundle \Tag \MappedParameter \TagsParameters ;
2929use Pimcore \Bundle \StudioBackendBundle \Tag \Schema \Tag ;
3030use Pimcore \Bundle \StudioBackendBundle \Tag \Service \TagServiceInterface ;
31+ use Pimcore \Bundle \StudioBackendBundle \Security \PermissionsToCheck ;
3132use Pimcore \Bundle \StudioBackendBundle \Util \Constant \HttpResponseCodes ;
3233use Pimcore \Bundle \StudioBackendBundle \Util \Constant \UserPermissions ;
3334use Pimcore \Bundle \StudioBackendBundle \Util \Trait \PaginatedResponseTrait ;
3435use Symfony \Component \HttpFoundation \JsonResponse ;
3536use Symfony \Component \HttpKernel \Attribute \MapQueryString ;
3637use Symfony \Component \Routing \Attribute \Route ;
37- use Symfony \Component \Security \Http \Attribute \IsGranted ;
3838use Symfony \Component \Serializer \SerializerInterface ;
3939
4040/**
@@ -55,7 +55,6 @@ public function __construct(
5555 * @throws InvalidQueryTypeException
5656 */
5757 #[Route('/tags ' , name: 'pimcore_studio_api_tags ' , methods: ['GET ' ])]
58- #[IsGranted(UserPermissions::TAGS_CONFIGURATION ->value )]
5958 #[Get(
6059 path: self ::PREFIX . '/tags ' ,
6160 operationId: 'tag_get_collection ' ,
@@ -81,6 +80,14 @@ public function __construct(
8180 public function getTags (
8281 #[MapQueryString] TagsParameters $ parameters ): JsonResponse
8382 {
83+ $ this ->denyAccessUnlessGranted (
84+ 'HasOneOf ' ,
85+ new PermissionsToCheck ([
86+ UserPermissions::TAGS_CONFIGURATION ->value ,
87+ UserPermissions::TAGS_SEARCH ->value ,
88+ ])
89+ );
90+
8491 return $ this ->jsonResponse (['items ' => $ this ->tagService ->listTags ($ parameters )]);
8592 }
8693}
0 commit comments