com\setasign\SetaFramework\Permissions
PermissionControl Class PermissionControl
File: /SetaFramework/src/Permissions/PermissionControl.php
Class hierarchy
Implements
- \Psr\Log\LoggerAwareInterface
- HasPermissionsInterface
Summary
Properties
$actions
Variable for all defined permissions ['ResourceName' => [callable | ['ActionName' => bool|callable]]]
$logger
protected ?\Psr\Log\LoggerInterface PermissionControl::$logger
Methods
addRole()
allow()
Allow one or more actions of a resource
Parameters
- $resource : ResourceDefinition
- $actionsOrCallback : array|string|callable|null
Exceptions
Throws \InvalidArgumentException
checkOwnPermissions()
protected PermissionControl::checkOwnPermissions (
string $name,
string $actionName,
?object $object
): intstring $actionName,
?object $object
Parameters
- $name : string
- the ResourceDefinition name
- $actionName : string
- the action name
- $object : ?object
- the allowed/denied object
Return Values
- 1 : allowed, -1 : denied
checkRolesPermissions()
Parameters
- $nameOrObject : object|string|ResourceDefinition
- $action : string
deny()
Deny one or more actions of a resource
Parameters
- $resource : ResourceDefinition
- $actionsOrCallback : array|string|callable|null
Exceptions
Throws \InvalidArgumentException
isAllowed()
Checks whether a action of a resource is allowed
Parameters
- $nameOrObject : object|string|ResourceDefinition
- $action : string
requirePermission()
Checks whether a action of a resource is allowed and if not an exception will be thrown
Parameters
- $nameOrObject : object|string|ResourceDefinition
- $action : string
Exceptions
Throws PermissionException If the permission is rejected!
resolveObject()
Parameters
- $object : ResourceDefinition|object
