Dynamic Assertions
Dynamic Assertions provide the capability to perform extra validations when +
Dynamic Assertions
Dynamic Assertions provide the capability to perform extra validations when
the authorization service's isGranted()
method is called.
As described in Authorization Service, it is possible to pass a context to the
isGranted()
method. This context is then passed to dynamic assertion functions. This context can be any object type.
Authorization Service
Usage
+Authorization Service
Usage
The Authorization service can be retrieved from the service manager using the name
LmcRbac\Service\AuthorizationServiceInterface
and injected into your code:
<?php
/** @var \Psr\Container\ContainerInterface $container */
$authorizationService = $container->get(LmcRbac\Service\AuthorizationServiceInterface::class);
ReferenceisGranted(?IdentityInterface $identity, string $permission, $context = null): bool
Parameter | Description |
---|---|
$identity | The identity whose roles to checks. If $identity is null, then the guest is used. The guest role is definable via configuration and defaults to 'guest' . |
$permission | The permission to check against |
$context | A context that will be passed to dynamic assertions that are defined for the permission |
More on dynamic assertions can be found in the Assertions section.
-More on the guest
role can be found in the Configuration section.
More on the guest
role can be found in the Configuration section.