Drupal 8  8.0.2
PermissionsHashGenerator Class Reference
Inheritance diagram for PermissionsHashGenerator:

Public Member Functions

 __construct (PrivateKey $private_key, CacheBackendInterface $cache, CacheBackendInterface $static)
 
 generate (AccountInterface $account)
 

Protected Member Functions

 doGenerate (array $roles)
 
 hash ($identifier)
 

Protected Attributes

 $privateKey
 
 $cache
 
 $static
 

Detailed Description

Generates and caches the permissions hash for a user.

Constructor & Destructor Documentation

__construct ( PrivateKey  $private_key,
CacheBackendInterface  $cache,
CacheBackendInterface  $static 
)

Constructs a PermissionsHashGenerator object.

Parameters
\Drupal\Core\PrivateKey$private_keyThe private key service.
\Drupal\Core\Cache\CacheBackendInterface$cacheThe cache backend interface to use for the persistent cache.
\Drupal\Core\Cache\CacheBackendInterfaceThe cache backend interface to use for the static cache.

References Drupal\cache().

Here is the call graph for this function:

Member Function Documentation

doGenerate ( array  $roles)
protected

Generates a hash that uniquely identifies the user's permissions.

Parameters
string[]$roles The user's roles.
Returns
string The permissions hash.

References PermissionsHashGenerator\hash().

Referenced by PermissionsHashGenerator\generate().

Here is the call graph for this function:

Here is the caller graph for this function:

generate ( AccountInterface  $account)

{Generates a hash that uniquely identifies a user's permissions.

Parameters
\Drupal\Core\Session\AccountInterface$accountThe user account for which to get the permissions hash.
Returns
string A permissions hash.
}

Cached by role, invalidated whenever permissions change.

Implements PermissionsHashGeneratorInterface.

References Cache\buildTags(), Drupal\cache(), PermissionsHashGenerator\doGenerate(), AccountInterface\getRoles(), PermissionsHashGenerator\hash(), AccountInterface\id(), and Cache\PERMANENT.

Here is the call graph for this function:

hash (   $identifier)
protected

Hashes the given string.

Parameters
string$identifierThe string to be hashed.
Returns
string The hash.

References Settings\getHashSalt().

Referenced by PermissionsHashGenerator\doGenerate(), and PermissionsHashGenerator\generate().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: