Skip to content

AssetsControllerTrait

Type
Trait
Namespace
craft\controllers
Implemented by
craft\controllers\AssetsController
Since
4.5.0

Provides asset permission enforcement methods for controllers.

View source

Public Methods

MethodDescription
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.

View source

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.

View source

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.

View source

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.

View source

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

Throws