File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717use Pimcore \Bundle \StudioBackendBundle \DataIndex \Provider \AssetQueryProviderInterface ;
1818use Pimcore \Bundle \StudioBackendBundle \DataIndex \Query \QueryInterface ;
1919use Pimcore \Bundle \StudioBackendBundle \DataIndex \Service \AssetSearchServiceInterface ;
20+ use Pimcore \Bundle \StudioBackendBundle \Exception \Api \ForbiddenException ;
2021use Pimcore \Bundle \StudioBackendBundle \Exception \Api \NotFoundException ;
2122use Pimcore \Bundle \StudioBackendBundle \Filter \MappedParameter \FilterParameter ;
2223use Pimcore \Bundle \StudioBackendBundle \Gdpr \Provider \Legacy \AssetExporterInterface ;
2324use Pimcore \Bundle \StudioBackendBundle \Gdpr \Schema \GdprDataRow ;
2425use Pimcore \Bundle \StudioBackendBundle \Response \Collection ;
26+ use Pimcore \Bundle \StudioBackendBundle \Util \Constant \ElementPermissions ;
2527use Pimcore \Bundle \StudioBackendBundle \Util \Constant \UserPermissions ;
2628use Pimcore \Model \Asset ;
2729use Symfony \Component \HttpFoundation \Response ;
30+ use function sprintf ;
2831
2932/**
3033 * @internal
@@ -130,6 +133,10 @@ public function getSingleItemForDownload(int $id): Response
130133 throw new NotFoundException ('Asset Not Found ' , $ id );
131134 }
132135
136+ if (!$ asset ->isAllowed (ElementPermissions::VIEW_PERMISSION )) {
137+ throw new ForbiddenException (sprintf ('Access Denied for asset with id "%d". ' , $ asset ->getId ()));
138+ }
139+
133140 return $ this ->assetExporter ->doExportData ($ asset );
134141 }
135142
Original file line number Diff line number Diff line change 1717use Pimcore \Bundle \StudioBackendBundle \DataIndex \Provider \DataObjectQueryProviderInterface ;
1818use Pimcore \Bundle \StudioBackendBundle \DataIndex \Query \QueryInterface ;
1919use Pimcore \Bundle \StudioBackendBundle \DataIndex \Service \DataObjectSearchServiceInterface ;
20+ use Pimcore \Bundle \StudioBackendBundle \Exception \Api \ForbiddenException ;
2021use Pimcore \Bundle \StudioBackendBundle \Exception \Api \NotFoundException ;
2122use Pimcore \Bundle \StudioBackendBundle \Filter \MappedParameter \FilterParameter ;
2223use Pimcore \Bundle \StudioBackendBundle \Gdpr \Provider \Legacy \ObjectExporterInterface ;
2324use Pimcore \Bundle \StudioBackendBundle \Gdpr \Schema \GdprDataRow ;
2425use Pimcore \Bundle \StudioBackendBundle \Response \Collection ;
26+ use Pimcore \Bundle \StudioBackendBundle \Util \Constant \ElementPermissions ;
2527use Pimcore \Bundle \StudioBackendBundle \Util \Constant \UserPermissions ;
2628use Pimcore \Model \DataObject ;
2729use Pimcore \Model \DataObject \Concrete ;
30+ use function sprintf ;
2831
2932/**
3033 * @internal
@@ -132,6 +135,10 @@ public function getSingleItemForDownload(int $id): array
132135 throw new NotFoundException ('Requested object is not a Concrete data object ' , $ id );
133136 }
134137
138+ if (!$ object ->isAllowed (ElementPermissions::VIEW_PERMISSION )) {
139+ throw new ForbiddenException (sprintf ('Access Denied for object with id "%d". ' , $ object ->getId ()));
140+ }
141+
135142 $ export = [
136143 'id ' => $ object ->getId (),
137144 'fullPath ' => $ object ->getFullPath (),
Original file line number Diff line number Diff line change @@ -213,6 +213,6 @@ public function getSortPriority(): int
213213 */
214214 public function getRequiredPermissions (): array
215215 {
216- return [UserPermissions::PIMCORE_USER ->value ];
216+ return [UserPermissions::USER_MANAGEMENT ->value ];
217217 }
218218}
You can’t perform that action at this time.
0 commit comments