class SecurityContext

A simple security manager, in charge of checking user

Methods

__construct( RequestStack $requestStack)

No description

getAdminUser()

Gets the currently authenticated user in the admin, or null if none is defined

true
hasAdminUser()

Check if an admin user is logged in.

Customer|null
getCustomerUser()

Gets the currently authenticated customer, or null if none is defined

true
hasCustomerUser()

Check if a customer user is logged in.

bool
hasLoggedInUser()

No description

boolean
hasRequiredRole( UserInterface $user = null, array $roles = array())

Check if a user has at least one of the required roles

isUserGranted( array $roles, array $resources, array $modules, array $accesses, UserInterface $user)

No description

Boolean
isGranted( array $roles, array $resources, array $modules, array $accesses)

Checks if the current user is allowed

checkRole( array $roles)

look if a user has the required role.

setAdminUser( UserInterface $user)

Sets the authenticated admin user.

setCustomerUser( UserInterface $user)

Sets the authenticated customer user.

clearCustomerUser()

Clear the customer from the security context

clearAdminUser()

Clear the admin from the security context

Details

at line 31
__construct( RequestStack $requestStack)

Parameters

RequestStack $requestStack

at line 55
UserInterface|null getAdminUser()

Gets the currently authenticated user in the admin, or null if none is defined

Return Value

UserInterface|null A UserInterface instance or null if no user is available

at line 65
true hasAdminUser()

Check if an admin user is logged in.

Return Value

true if an admin user is logged in, false otherwise.

at line 75
Customer|null getCustomerUser()

Gets the currently authenticated customer, or null if none is defined

Return Value

Customer|null A UserInterface instance or null if no user is available

at line 85
true hasCustomerUser()

Check if a customer user is logged in.

Return Value

true if a customer is logged in, false otherwise.

at line 93
final bool hasLoggedInUser()

Return Value

bool true if a user (either admin or customer) is logged in, false otherwise.

at line 105
final boolean hasRequiredRole( UserInterface $user = null, array $roles = array())

Check if a user has at least one of the required roles

Parameters

UserInterface $user the user
array $roles the roles

Return Value

boolean true if the user has the required role, false otherwise

at line 121
final isUserGranted( array $roles, array $resources, array $modules, array $accesses, UserInterface $user)

Parameters

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

Parameters

array $roles
array $resources
array $modules
array $accesses

Return Value

Boolean

at line 207
null|UserInterface checkRole( array $roles)

look if a user has the required role.

Parameters

array $roles

Return Value

null|UserInterface

at line 228
setAdminUser( UserInterface $user)

Sets the authenticated admin user.

Parameters

UserInterface $user A UserInterface, or null if no further user should be stored

at line 240
setCustomerUser( UserInterface $user)

Sets the authenticated customer user.

Parameters

UserInterface $user A UserInterface, or null if no further user should be stored

at line 250
clearCustomerUser()

Clear the customer from the security context

at line 258
clearAdminUser()

Clear the admin from the security context