class AlligatorRoleExtension extends Twig_Extension

Class AlligatorRoleExtension is injected as twig.extension.alligator.role service. AlligatorRoleExtension handles the logic and provides necessary data for managed entity in twig.

Constants

ROLE_ROUTE_PERMISSIONS_REDIS_KEY

Properties

protected mixed $redisCache
protected RouterInterface $router
protected array|null $cachedPermissions
protected TokenStorageInterface $tokenStorage
protected array $userRoles
protected RoleManager $roleManager
protected string $allRoutes

Methods

__construct(mixed $redisCache, RouterInterface $router, TokenStorageInterface $tokenStorage, RoleManager $roleManager)

AlligatorRoleExtension constructor.

getFunctions()

{@inheritdoc}

bool
isAllowedAccessToSubRoutes(array $routes)

No description

bool
isAllowedAccess(string $routeName, array $params = [])

Check if logged user can access provided route

string
getAllRoutesForBackend()

No description

bool
checkRolePermissions(mixed $permission, mixed $role)

No description

bool
canSeeQuantityLight(array|string $productPermissions)

Check if there are permissions on product to see quantity light

bool
canSeeQuantity(array|string $productPermissions)

Check if there are permissions on product to see quantity

bool
checkUserAndProductPermissions(string $permission, array|string $productPermissions)

Check if there is provided permission on user or product

array
getAllRoles()

Retrieve all roles

string
getName()

Returns the name of the extension.

mixed
checkAdditionalProductPermission(array|string $productPermissions, mixed $param)

Check for special product permissions

string|null
getBackendRouteForUser()

No description

Details

at line 72
__construct(mixed $redisCache, RouterInterface $router, TokenStorageInterface $tokenStorage, RoleManager $roleManager)

AlligatorRoleExtension constructor.

Parameters

mixed $redisCache
RouterInterface $router
TokenStorageInterface $tokenStorage
RoleManager $roleManager

at line 83
getFunctions()

{@inheritdoc}

at line 103
bool isAllowedAccessToSubRoutes(array $routes)

Parameters

array $routes

Return Value

bool

at line 121
bool isAllowedAccess(string $routeName, array $params = [])

Check if logged user can access provided route

Parameters

string $routeName
array $params

Return Value

bool

at line 169
string getAllRoutesForBackend()

Return Value

string

Exceptions

Error

at line 185
bool checkRolePermissions(mixed $permission, mixed $role)

Parameters

mixed $permission
mixed $role

Return Value

bool

at line 196
bool canSeeQuantityLight(array|string $productPermissions)

Check if there are permissions on product to see quantity light

Parameters

array|string $productPermissions

Return Value

bool

at line 207
bool canSeeQuantity(array|string $productPermissions)

Check if there are permissions on product to see quantity

Parameters

array|string $productPermissions

Return Value

bool

at line 219
bool checkUserAndProductPermissions(string $permission, array|string $productPermissions)

Check if there is provided permission on user or product

Parameters

string $permission
array|string $productPermissions

Return Value

bool

at line 237
array getAllRoles()

Retrieve all roles

Return Value

array

at line 247
string getName()

Returns the name of the extension.

Return Value

string The extension name

at line 259
mixed checkAdditionalProductPermission(array|string $productPermissions, mixed $param)

Check for special product permissions

Parameters

array|string $productPermissions
mixed $param

Return Value

mixed

at line 267
string|null getBackendRouteForUser()

Return Value

string|null