Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Tag/Controller/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
use Pimcore\Bundle\StudioBackendBundle\Tag\MappedParameter\TagsParameters;
use Pimcore\Bundle\StudioBackendBundle\Tag\Schema\Tag;
use Pimcore\Bundle\StudioBackendBundle\Tag\Service\TagServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Security\PermissionsToCheck;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\PaginatedResponseTrait;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand All @@ -55,7 +55,6 @@
* @throws InvalidQueryTypeException
*/
#[Route('/tags', name: 'pimcore_studio_api_tags', methods: ['GET'])]
#[IsGranted(UserPermissions::TAGS_CONFIGURATION->value)]
#[Get(
path: self::PREFIX . '/tags',
operationId: 'tag_get_collection',
Expand All @@ -81,6 +80,14 @@
public function getTags(
#[MapQueryString] TagsParameters $parameters): JsonResponse
{
$this->denyAccessUnlessGranted(
'HasOneOf',
new PermissionsToCheck([

Check notice on line 85 in src/Tag/Controller/CollectionController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Tag/Controller/CollectionController.php#L85

Opening parenthesis of a multi-line function call must be the last content on the line
UserPermissions::TAGS_CONFIGURATION->value,
UserPermissions::TAGS_SEARCH->value,
])

Check notice on line 88 in src/Tag/Controller/CollectionController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Tag/Controller/CollectionController.php#L88

Closing parenthesis of a multi-line function call must be on a line by itself
);

return $this->jsonResponse(['items' => $this->tagService->listTags($parameters)]);
}
}
11 changes: 9 additions & 2 deletions src/Tag/Controller/GetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Tag\Schema\Tag;
use Pimcore\Bundle\StudioBackendBundle\Tag\Service\TagServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Security\PermissionsToCheck;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand All @@ -42,7 +42,6 @@
}

#[Route('/tags/{id}', name: 'pimcore_studio_api_get_tag', methods: ['GET'])]
#[IsGranted(UserPermissions::TAGS_CONFIGURATION->value)]
#[Get(
path: self::PREFIX . '/tags/{id}',
operationId: 'tag_get_by_id',
Expand All @@ -61,6 +60,14 @@
])]
public function getTags(int $id): JsonResponse
{
$this->denyAccessUnlessGranted(
'HasOneOf',
new PermissionsToCheck([

Check notice on line 65 in src/Tag/Controller/GetController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Tag/Controller/GetController.php#L65

Opening parenthesis of a multi-line function call must be the last content on the line
UserPermissions::TAGS_CONFIGURATION->value,
UserPermissions::TAGS_SEARCH->value,
])

Check notice on line 68 in src/Tag/Controller/GetController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Tag/Controller/GetController.php#L68

Closing parenthesis of a multi-line function call must be on a line by itself
);

return $this->jsonResponse($this->tagService->getTag($id));
}
}
Loading