AssetsControllerTrait ​
- Type
- Trait
- Namespace
- craft\controllers
- Implemented by
- craft\controllers\AssetsController
- Since
- 4.5.0
Provides asset permission enforcement methods for controllers.
Public Methods ​
Method | Description |
---|---|
requirePeerVolumePermissionByAsset() | Requires a peer permission for a given asset, unless it was uploaded by the current user. |
requireVolumePermission() | Requires a volume permission by its UID. |
requireVolumePermissionByAsset() | Requires a volume permission for a given asset. |
requireVolumePermissionByFolder() | Requires a volume permission for a given folder. |
requirePeerVolumePermissionByAsset()
​
Requires a peer permission for a given asset, unless it was uploaded by the current user.
Arguments ​
$permissionName
(string) – The name of the peer permission to require (sans:<volume-uid>
suffix)$asset
(craft\elements\Asset) – The asset whose volume should be checked
Throws ​
requireVolumePermission()
​
Requires a volume permission by its UID.
Arguments ​
$permissionName
(string) – The name of the peer permission to require (sans:<volume-uid>
suffix)$volumeUid
(string) – The volume’s UID
Throws ​
requireVolumePermissionByAsset()
​
Requires a volume permission for a given asset.
Arguments ​
$permissionName
(string) – The name of the permission to require (sans:<volume-uid>
suffix)$asset
(craft\elements\Asset) – The asset whose volume should be checked
Throws ​
requireVolumePermissionByFolder()
​
Requires a volume permission for a given folder.
Arguments ​
$permissionName
(string) – The name of the peer permission to require (sans:<volume-uid>
suffix)$folder
(craft\models\VolumeFolder) – The folder whose volume should be checked