SecurityContext
class SecurityContext
A simple security manager, in charge of checking user
Methods
No description
Gets the currently authenticated user in the admin, or null if none is defined
Check if an admin user is logged in.
Gets the currently authenticated customer, or null if none is defined
Check if a customer user is logged in.
No description
Check if a user has at least one of the required roles
No description
Checks if the current user is allowed
look if a user has the required role.
Sets the authenticated admin user.
Sets the authenticated customer user.
Clear the customer from the security context
Clear the admin from the security context
Details
at line 31
__construct(
RequestStack $requestStack)
at line 55
UserInterface|null
getAdminUser()
Gets the currently authenticated user in the admin, or null if none is defined
at line 65
true
hasAdminUser()
Check if an admin user is logged in.
at line 75
Customer|null
getCustomerUser()
Gets the currently authenticated customer, or null if none is defined
at line 85
true
hasCustomerUser()
Check if a customer user is logged in.
at line 93
final
bool
hasLoggedInUser()
at line 105
final
boolean
hasRequiredRole(
UserInterface $user = null,
array $roles = array())
Check if a user has at least one of the required roles
at line 121
final
isUserGranted(
array $roles,
array $resources,
array $modules,
array $accesses,
UserInterface $user)
at line 189
final
Boolean
isGranted(
array $roles,
array $resources,
array $modules,
array $accesses)
Checks if the current user is allowed
at line 207
null|UserInterface
checkRole(
array $roles)
look if a user has the required role.
at line 228
setAdminUser(
UserInterface $user)
Sets the authenticated admin user.
at line 240
setCustomerUser(
UserInterface $user)
Sets the authenticated customer user.
at line 250
clearCustomerUser()
Clear the customer from the security context
at line 258
clearAdminUser()
Clear the admin from the security context