PHP Class ZfcRbac\Service\AuthorizationService

Author: MichaĆ«l Gallego ([email protected])
Inheritance: implements ZfcRbac\Service\AuthorizationServiceInterface
Datei anzeigen Open project: zf-commons/zfc-rbac Class Usage Examples

Protected Properties

Property Type Description
$assertionPluginManager ZfcRbac\Assertion\AssertionPluginManager
$assertions array
$rbac Rbac\Rbac
$roleService RoleService

Public Methods

Method Description
__construct ( Rbac\Rbac $rbac, RoleService $roleService, AssertionPluginManager $assertionPluginManager ) Constructor
getIdentity ( ) : ZfcRbac\Identity\IdentityInterface | null Get the current identity from the role service
hasAssertion ( string | Rbac\Permission\PermissionInterface $permission ) : boolean Checks if a assertion exists
isGranted ( string | Rbac\Permission\PermissionInterface $permission, mixed $context = null ) : boolean Check if the permission is granted to the current identity
setAssertion ( string | Rbac\Permission\PermissionInterface $permission, string | callable | ZfcRbac\Assertion\AssertionInterface $assertion ) : void Set an assertion
setAssertions ( array $assertions ) : void Set assertions

Protected Methods

Method Description
assert ( string | callable | ZfcRbac\Assertion\AssertionInterface $assertion, mixed $context = null ) : boolean

Method Details

__construct() public method

Constructor
public __construct ( Rbac\Rbac $rbac, RoleService $roleService, AssertionPluginManager $assertionPluginManager )
$rbac Rbac\Rbac
$roleService RoleService
$assertionPluginManager ZfcRbac\Assertion\AssertionPluginManager

assert() protected method

protected assert ( string | callable | ZfcRbac\Assertion\AssertionInterface $assertion, mixed $context = null ) : boolean
$assertion string | callable | ZfcRbac\Assertion\AssertionInterface
$context mixed
return boolean

getIdentity() public method

Get the current identity from the role service
public getIdentity ( ) : ZfcRbac\Identity\IdentityInterface | null
return ZfcRbac\Identity\IdentityInterface | null

hasAssertion() public method

Checks if a assertion exists
public hasAssertion ( string | Rbac\Permission\PermissionInterface $permission ) : boolean
$permission string | Rbac\Permission\PermissionInterface
return boolean

isGranted() public method

Check if the permission is granted to the current identity
public isGranted ( string | Rbac\Permission\PermissionInterface $permission, mixed $context = null ) : boolean
$permission string | Rbac\Permission\PermissionInterface
$context mixed
return boolean

setAssertion() public method

Set an assertion
public setAssertion ( string | Rbac\Permission\PermissionInterface $permission, string | callable | ZfcRbac\Assertion\AssertionInterface $assertion ) : void
$permission string | Rbac\Permission\PermissionInterface
$assertion string | callable | ZfcRbac\Assertion\AssertionInterface
return void

setAssertions() public method

Set assertions
public setAssertions ( array $assertions ) : void
$assertions array
return void

Property Details

$assertionPluginManager protected_oe property

protected AssertionPluginManager,ZfcRbac\Assertion $assertionPluginManager
return ZfcRbac\Assertion\AssertionPluginManager

$assertions protected_oe property

protected array $assertions
return array

$rbac protected_oe property

protected Rbac,Rbac $rbac
return Rbac\Rbac

$roleService protected_oe property

protected RoleService,ZfcRbac\Service $roleService
return RoleService