Skip to content

Commit

Permalink
Permissions rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasHermanek committed May 27, 2024
1 parent 4e9cc96 commit 63e435a
Show file tree
Hide file tree
Showing 37 changed files with 125 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Adm/AudioFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AudioFileController extends AbstractAssetFileController
#[OAParameterPath('audio')]
public function download(AudioFile $audio): Response
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_VIEW, $audio);
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_READ, $audio);

return $this->getDownloadResponse($audio);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Adm/DocumentFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class DocumentFileController extends AbstractAssetFileController
#[OAParameterPath('document')]
public function download(DocumentFile $document): Response
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_VIEW, $document);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_READ, $document);

return $this->getDownloadResponse($document);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Adm/ImageFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ImageFileController extends AbstractAssetFileController
#[OAParameterPath('image')]
public function download(ImageFile $image): Response
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_VIEW, $image);
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_READ, $image);

return $this->getDownloadResponse($image);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Adm/VideoFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class VideoFileController extends AbstractAssetFileController
#[OAParameterPath('video')]
public function download(VideoFile $video): Response
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_VIDEO_VIEW, $video);
$this->denyAccessUnlessGranted(DamPermissions::DAM_VIDEO_READ, $video);

return $this->getDownloadResponse($video);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/Api/Adm/V1/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function create(#[SerializeParam] AssetAdmCreateDto $assetDto, AssetLicen
public function searchByLicence(AssetLicence $assetLicence, #[SerializeParam] AssetAdmSearchLicenceCollectionDto $searchDto): JsonResponse
{
App::throwOnReadOnlyMode();
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $assetLicence);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $assetLicence);
$searchDto->setLicences(new ArrayCollection([$assetLicence]));

return $this->okResponse(
Expand All @@ -106,7 +106,7 @@ public function searchByLicence(AssetLicence $assetLicence, #[SerializeParam] As
public function search(#[SerializeParam] AssetAdmSearchLicenceCollectionDto $searchDto): JsonResponse
{
App::throwOnReadOnlyMode();
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $searchDto);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $searchDto);

return $this->okResponse(
$this->elasticSearch->searchInfiniteList($searchDto)
Expand All @@ -122,7 +122,7 @@ public function search(#[SerializeParam] AssetAdmSearchLicenceCollectionDto $sea
#[OAParameterPath('search', description: 'Searched asset.'), OAResponse([AssetAdmListDto::class])]
public function searchByExtSystem(ExtSystem $extSystem, #[SerializeParam] AssetAdmSearchDto $searchDto): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $extSystem);

return $this->okResponse(
$this->elasticSearch->searchInfiniteListByExtSystem($searchDto, $extSystem)
Expand All @@ -135,7 +135,7 @@ public function getByLicenceAndIds(
#[ArrayStringParam(itemsLimit: self::IDS_LIMIT)]
array $ids,
): JsonResponse {
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $assetLicence);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $assetLicence);

return $this->okResponse(
$this->admRepositoryDecorator->findByLicenceAndIds($assetLicence, $ids)
Expand All @@ -148,7 +148,7 @@ public function getByExtSystemAndIds(
#[ArrayStringParam(itemsLimit: self::IDS_LIMIT, itemNormalizer: 'intval')]
array $ids,
): JsonResponse {
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $extSystem);

return $this->okResponse(
$this->admRepositoryDecorator->findByExtSystemAndIds($extSystem, $ids)
Expand All @@ -162,7 +162,7 @@ public function getByExtSystemAndIds(
#[OAResponse(AssetAdmDetailDto::class)]
public function getOne(Asset $asset): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $asset);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $asset);

return $this->okResponse(AssetAdmDetailDto::getInstance($asset));
}
Expand All @@ -174,7 +174,7 @@ public function getOne(Asset $asset): JsonResponse
#[OAResponse(AssetAdmDetailDto::class)]
public function getOneByAssetFile(AssetFile $assetFile): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $assetFile->getAsset());
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $assetFile->getAsset());

return $this->okResponse(AssetAdmDetailDto::getInstance($assetFile->getAsset()));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/AssetCustomFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
public function getOne(ExtSystem $extSystem, AssetType $assetType): JsonResponse
{
$form = $this->assetCustomFormRepository->findOneByTypeAndExtSystem($extSystem, $assetType);
$this->denyAccessUnlessGranted(DamPermissions::DAM_CUSTOM_FORM_VIEW, $form);
$this->denyAccessUnlessGranted(DamPermissions::DAM_CUSTOM_FORM_READ, $form);

return $form
? $this->okResponse($form)
Expand All @@ -68,7 +68,7 @@ public function getElements(ExtSystem $extSystem, AssetType $assetType, ApiParam
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_CUSTOM_FORM_ELEMENT_VIEW);
$form = $this->assetCustomFormRepository->findOneByTypeAndExtSystem($extSystem, $assetType);
$this->denyAccessUnlessGranted(DamPermissions::DAM_CUSTOM_FORM_VIEW, $form);
$this->denyAccessUnlessGranted(DamPermissions::DAM_CUSTOM_FORM_READ, $form);

if (null === $form) {
return $this->okResponse(new ApiResponseList());
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/AssetLicenceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
#[OAParameterPath('assetLicence'), OAResponse(AssetLicence::class)]
public function getOne(AssetLicence $assetLicence): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_LICENCE_VIEW, $assetLicence);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_LICENCE_READ, $assetLicence);

return $this->okResponse($assetLicence);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/AssetLicenceGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
#[OAParameterPath('assetLicenceGroup'), OAResponse(AssetLicenceGroup::class)]
public function getOne(AssetLicenceGroup $assetLicenceGroup): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_LICENCE_GROUP_VIEW, $assetLicenceGroup);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_LICENCE_GROUP_READ, $assetLicenceGroup);

return $this->okResponse($assetLicenceGroup);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/AssetSlotController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
#[OAParameterPath('asset'), OAResponse(AssetSlotAdmListDecorator::class), OAResponseValidation]
public function list(Asset $asset): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $asset);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $asset);

return $this->okResponse($this->assetSlotFacade->decorateAssetSlots($asset));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/AudioController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function addChunk(AudioFile $audio, ChunkAdmCreateDto $chunk): JsonRespon
#[OAResponse(AudioFileAdmDetailDto::class)]
public function getOne(AudioFile $audio): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_VIEW, $audio);
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_READ, $audio);

return $this->okResponse(AudioFileAdmDetailDto::getInstance($audio));
}
Expand Down Expand Up @@ -236,7 +236,7 @@ public function delete(AudioFile $audio): JsonResponse
#[OAParameterPath('audio'), OAResponseValidation]
public function generateDownloadUrl(AudioFile $audio): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_VIEW, $audio);
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUDIO_READ, $audio);

return $this->okResponse(
$this->assetFileDownloadFacade->decorateDownloadLink($audio)
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/AuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
#[OAParameterPath('author'), OAResponse(Author::class)]
public function getOne(Author $author): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUTHOR_VIEW, $author);
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUTHOR_READ, $author);

return $this->okResponse($author);
}
Expand All @@ -55,7 +55,7 @@ public function getOne(Author $author): JsonResponse
#[OAParameterPath('search', description: 'Searched.'), OAResponse([Author::class])]
public function searchByExtSystem(ExtSystem $extSystem, #[SerializeParam] AuthorAdmSearchDto $searchDto): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUTHOR_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_AUTHOR_READ, $extSystem);

return $this->okResponse($this->elasticSearch->searchInfiniteList($searchDto, $extSystem));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function get(): JsonResponse
#[OAResponse(ExtSystemAdmGetDecorator::class)]
public function getExtSystem(ExtSystem $extSystem): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_EXT_SYSTEM_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_EXT_SYSTEM_READ, $extSystem);

return $this->okResponse(
$this->configurationFacade->decorateExtSystemAdm($extSystem),
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/CustomDistributionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function delete(Distribution $distribution): JsonResponse
public function redistribute(Distribution $distribution, #[SerializeParam] CustomDistributionAdmDto $customDistribution): JsonResponse
{
App::throwOnReadOnlyMode();
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $this->assetRepository->find($distribution->getAssetId()));
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $this->assetRepository->find($distribution->getAssetId()));
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_ACCESS, $distribution->getDistributionService());

return $this->okResponse(
Expand All @@ -98,7 +98,7 @@ public function redistribute(Distribution $distribution, #[SerializeParam] Custo
#[OAParameterPath('assetFile'), OAParameterPath('distributionService'), OAResponse(CustomDistributionAdmDto::class)]
public function preparePayload(AssetFile $assetFile, string $distributionService): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $assetFile);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $assetFile);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_ACCESS, $distributionService);

return $this->okResponse(
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/DistributionCategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
#[OAParameterPath('distributionCategory'), OAResponse(DistributionCategory::class)]
public function getOne(DistributionCategory $distributionCategory): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_VIEW, $distributionCategory);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_READ, $distributionCategory);

return $this->okResponse($distributionCategory);
}
Expand All @@ -57,7 +57,7 @@ public function getOne(DistributionCategory $distributionCategory): JsonResponse
#[OAParameterPath('extSystem'), OAParameterPath('type'), OAResponse([DistributionCategory::class])]
public function getList(ApiParams $apiParams, ExtSystem $extSystem): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_READ, $extSystem);

return $this->okResponse(
$this->distributionCategoryAdmRepositoryDecorator->findByApiParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
#[OAParameterPath('distributionCategorySelect'), OAResponse(DistributionCategorySelect::class)]
public function getOne(DistributionCategorySelect $distributionCategorySelect): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_SELECT_VIEW, $distributionCategorySelect);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_SELECT_READ, $distributionCategorySelect);

return $this->okResponse($distributionCategorySelect);
}
Expand All @@ -58,7 +58,7 @@ public function getOne(DistributionCategorySelect $distributionCategorySelect):
#[OAParameterPath('extSystem'), OAParameterPath('assetType'), OAResponse([DistributionCategorySelect::class])]
public function getList(ApiParams $apiParams, ExtSystem $extSystem, AssetType $assetType = null): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_SELECT_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_CATEGORY_SELECT_READ, $extSystem);

return $this->okResponse(
$this->distributionCategorySelectAdmRepoDecorator->findByApiParams(
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/DistributionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getOne(Distribution $distribution): JsonResponse
#[OAParameterPath('assetFile'), OAResponse([Distribution::class])]
public function getAssetDistributionList(Asset $asset, ApiParams $apiParams): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $asset);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $asset);

return $this->okResponse(
$this->distributionRepository->findByApiParamsByAsset($apiParams, $asset)
Expand All @@ -83,7 +83,7 @@ public function getAssetDistributionList(Asset $asset, ApiParams $apiParams): Js
#[OAParameterPath('assetFile'), OAResponse([Distribution::class])]
public function getAssetFileDistributionList(AssetFile $assetFile, ApiParams $apiParams): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $assetFile);
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $assetFile);

return $this->okResponse(
$this->distributionRepository->findByApiParamsByAssetFile($apiParams, $assetFile)
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function addChunk(DocumentFile $document, ChunkAdmCreateDto $chunk): Json
#[OAResponse(DocumentFileAdmDetailDto::class)]
public function getOne(DocumentFile $document): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_VIEW, $document);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_READ, $document);

return $this->okResponse(DocumentFileAdmDetailDto::getInstance($document));
}
Expand Down Expand Up @@ -235,7 +235,7 @@ public function delete(DocumentFile $document): JsonResponse
#[OAParameterPath('document'), OAResponseValidation]
public function generateDownloadUrl(DocumentFile $document): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_VIEW, $document);
$this->denyAccessUnlessGranted(DamPermissions::DAM_DOCUMENT_READ, $document);

return $this->okResponse(
$this->assetFileDownloadFacade->decorateDownloadLink($document)
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/ExtSystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
#[OAParameterPath('extSystem'), OAResponse(ExtSystem::class)]
public function getOne(ExtSystem $extSystem): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_EXT_SYSTEM_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_EXT_SYSTEM_READ, $extSystem);

return $this->okResponse($extSystem);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function addChunk(ImageFile $image, ChunkAdmCreateDto $chunk): JsonRespon
#[OAResponse(ImageFileAdmDetailDto::class)]
public function getOne(ImageFile $image): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_VIEW, $image);
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_READ, $image);

return $this->okResponse(ImageFileAdmDetailDto::getInstance($image));
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public function delete(ImageFile $image): JsonResponse
#[OAParameterPath('image'), OAResponseValidation]
public function generateDownloadUrl(ImageFile $image): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_VIEW, $image);
$this->denyAccessUnlessGranted(DamPermissions::DAM_IMAGE_READ, $image);

return $this->okResponse(
$this->assetFileDownloadFacade->decorateDownloadLink($image)
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Adm/V1/JwDistributionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function distribute(AssetFile $assetFile, #[SerializeParam] JwDistributio
public function redistribute(JwDistribution $distribution, #[SerializeParam] JwDistribution $newDistribution): JsonResponse
{
App::throwOnReadOnlyMode();
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_VIEW, $this->assetRepository->find($distribution->getAssetId()));
$this->denyAccessUnlessGranted(DamPermissions::DAM_ASSET_READ, $this->assetRepository->find($distribution->getAssetId()));
$this->denyAccessUnlessGranted(DamPermissions::DAM_DISTRIBUTION_ACCESS, $distribution->getDistributionService());

return $this->okResponse(
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Api/Adm/V1/KeywordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
#[OAParameterPath('keyword'), OAResponse(Keyword::class)]
public function getOne(Keyword $keyword): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_KEYWORD_VIEW, $keyword);
$this->denyAccessUnlessGranted(DamPermissions::DAM_KEYWORD_READ, $keyword);

return $this->okResponse($keyword);
}
Expand All @@ -56,7 +56,7 @@ public function getOne(Keyword $keyword): JsonResponse
#[OAParameterPath('search', description: 'Searched.'), OAResponse([Keyword::class])]
public function searchByExtSystem(ExtSystem $extSystem, #[SerializeParam] KeywordAdmSearchDto $searchDto): JsonResponse
{
$this->denyAccessUnlessGranted(DamPermissions::DAM_KEYWORD_VIEW, $extSystem);
$this->denyAccessUnlessGranted(DamPermissions::DAM_KEYWORD_READ, $extSystem);

return $this->okResponse($this->elasticSearch->searchInfiniteList($searchDto, $extSystem));
}
Expand Down
Loading

0 comments on commit 63e435a

Please sign in to comment.