trait HasPermissions (View source)

Methods

BelongsToMany
permissions()

This method should be clean of checks, the checks should happen earlier on.

void
grantGlobalPermission(string $name)

Add global permission to item, after making sure the permission is valid

void
revokeGlobalPermission(string $name)

Revoke global permission from the item, after making sure the permission is valid

void
grantModulePermission(string $name, string|object $permissionableType)

Add module permission to item, after making sure the permission is valid

void
revokeModulePermission(string $name, string|object $permissionableType)

Revoke module permission from the item, after making sure the permission is valid

void
revokeAllModulePermission(string|object $permissionableType)

Revoke all module permissions from the item

void
grantModuleItemPermission(string $name, object $permissionableItem)

Add module item permission, after making sure the permission is valid

void
revokeModuleItemPermission(string $name, object $permissionableItem)

Revoke module item permissions, after making sure the permission is valid

void
revokeModuleItemAllPermissions(object $permissionableItem)

Revoke all module item permissions

void
revokeAllPermissions()

Revoke all permissions

void
removePermissions(int[] $permissionableIds)

Revoke all permissions from a list of permission ids

void
checkPermissionAvailable(string $name, string $scope)

Check if a permission is available for a particular scope

Details

BelongsToMany permissions()

This method should be clean of checks, the checks should happen earlier on.

Return Value

BelongsToMany

void grantGlobalPermission(string $name)

Add global permission to item, after making sure the permission is valid

Parameters

string $name

Return Value

void

void revokeGlobalPermission(string $name)

Revoke global permission from the item, after making sure the permission is valid

Parameters

string $name

Return Value

void

void grantModulePermission(string $name, string|object $permissionableType)

Add module permission to item, after making sure the permission is valid

Parameters

string $name
string|object $permissionableType

Return Value

void

void revokeModulePermission(string $name, string|object $permissionableType)

Revoke module permission from the item, after making sure the permission is valid

Parameters

string $name
string|object $permissionableType

Return Value

void

void revokeAllModulePermission(string|object $permissionableType)

Revoke all module permissions from the item

Parameters

string|object $permissionableType

Return Value

void

void grantModuleItemPermission(string $name, object $permissionableItem)

Add module item permission, after making sure the permission is valid

Parameters

string $name
object $permissionableItem

Return Value

void

void revokeModuleItemPermission(string $name, object $permissionableItem)

Revoke module item permissions, after making sure the permission is valid

Parameters

string $name
object $permissionableItem

Return Value

void

void revokeModuleItemAllPermissions(object $permissionableItem)

Revoke all module item permissions

Parameters

object $permissionableItem

Return Value

void

void revokeAllPermissions()

Revoke all permissions

Return Value

void

void removePermissions(int[] $permissionableIds)

Revoke all permissions from a list of permission ids

Parameters

int[] $permissionableIds

Return Value

void

protected void checkPermissionAvailable(string $name, string $scope)

Check if a permission is available for a particular scope

Parameters

string $name
string $scope

Return Value

void

See also

Permission::SCOPE_GLOBAL
Permission::SCOPE_MODULE
Permission::SCOPE_ITEM