class PermissionsHashGenerator implements PermissionsHashGeneratorInterface (View source)

Generates and caches the permissions hash for a user.

Properties

protected PrivateKey $privateKey

The private key service.

protected CacheBackendInterface $cache

The cache backend interface to use for the persistent cache.

protected CacheBackendInterface $static

The cache backend interface to use for the static cache.

Methods

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

Constructs a PermissionsHashGenerator object.

string
generate(AccountInterface $account)

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

string
doGenerate(array $roles)

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

string
hash(string $identifier)

Hashes the given string.

Details

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

Constructs a PermissionsHashGenerator object.

Parameters

PrivateKey $private_key

The private key service.

CacheBackendInterface $cache

The cache backend interface to use for the persistent cache.

CacheBackendInterface $static

The cache backend interface to use for the static cache.

string generate(AccountInterface $account)

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

Parameters

AccountInterface $account

The user account for which to get the permissions hash.

Return Value

string

A permissions hash.

protected string doGenerate(array $roles)

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

Parameters

array $roles

The user's roles.

Return Value

string

The permissions hash.

protected string hash(string $identifier)

Hashes the given string.

Parameters

string $identifier

The string to be hashed.

Return Value

string

The hash.