Skip to content

Commit

Permalink
add asset permission check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukmzig committed Jun 12, 2024
1 parent 8905fb0 commit 71e5cfb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Asset/Controller/Video/ImageThumbnailStreamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\HttpResponseHeaders;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\UserPermissions;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand Down Expand Up @@ -73,8 +75,7 @@ public function __construct(
name: 'pimcore_studio_api_stream_video_image_thumbnail',
methods: ['GET']
)]
//#[IsGranted('STUDIO_API')]
//#[IsGranted(UserPermissions::ASSETS->value)]
#[IsGranted(UserPermissions::ASSETS->value)]
#[Get(
path: self::API_PATH . '/assets/{id}/video/stream/imageThumbnail',
operationId: 'getVideoImageThumbnail',
Expand Down
5 changes: 3 additions & 2 deletions src/Asset/Controller/Video/ThumbnailDownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\UserPermissions;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand Down Expand Up @@ -68,8 +70,7 @@ public function __construct(
name: 'pimcore_studio_api_download_video_thumbnail',
methods: ['GET']
)]
//#[IsGranted('STUDIO_API')]
//#[IsGranted(UserPermissions::ASSETS->value)]
#[IsGranted(UserPermissions::ASSETS->value)]
#[Get(
path: self::API_PATH . '/assets/{id}/video/download/{thumbnailName}',
operationId: 'downloadVideoByThumbnail',
Expand Down
5 changes: 3 additions & 2 deletions src/Asset/Controller/Video/ThumbnailStreamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\UserPermissions;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand Down Expand Up @@ -68,8 +70,7 @@ public function __construct(
name: 'pimcore_studio_api_stream_video_thumbnail',
methods: ['GET']
)]
//#[IsGranted('STUDIO_API')]
//#[IsGranted(UserPermissions::ASSETS->value)]
#[IsGranted(UserPermissions::ASSETS->value)]
#[Get(
path: self::API_PATH . '/assets/{id}/video/stream/{thumbnailName}',
operationId: 'streamVideoByThumbnail',
Expand Down

0 comments on commit 71e5cfb

Please sign in to comment.