User
class User extends Object
User authentication and authorization.
Constants
deprecated MANUAL |
|
deprecated INACTIVITY |
|
deprecated BROWSER_CLOSED |
|
Properties
string | $guestRole | ||
string | $authenticatedRole | ||
callable[] | $onLoggedIn | ||
callable[] | $onLoggedOut | ||
IAuthenticator | $authenticator | ||
IAuthorizator | $authorizator | ||
bool read-only | $loggedIn | ||
IIdentity read-only | $identity | ||
mixed read-only | $id | ||
array read-only | $roles | ||
int read-only | $logoutReason |
Methods
No description
No description
Conducts the authentication process. Parameters are optional.
Logs out the user from the current session.
Is this user authenticated?
Returns current user identity, if any.
Returns current user ID, if any.
Returns authentication handler.
Enables log out after inactivity.
Why was user logged out?
Returns a list of effective roles that a user has been granted.
Is a user in the specified effective role?
Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.
Returns current authorization handler.
Details
at line 53
__construct(IUserStorage $storage, IAuthenticator $authenticator = NULL, IAuthorizator $authorizator = NULL)
No description
at line 64
IUserStorage
getStorage()
No description
at line 80
void
login($id = NULL, $password = NULL)
Conducts the authentication process. Parameters are optional.
at line 97
void
logout($clearIdentity = FALSE)
Logs out the user from the current session.
at line 113
bool
isLoggedIn()
Is this user authenticated?
at line 123
IIdentity|null
getIdentity()
Returns current user identity, if any.
at line 133
mixed
getId()
Returns current user ID, if any.
at line 144
User
setAuthenticator(IAuthenticator $handler)
Sets authentication handler.
at line 155
IAuthenticator
getAuthenticator($need = TRUE)
Returns authentication handler.
at line 171
User
setExpiration($time, $whenBrowserIsClosed = TRUE, $clearIdentity = FALSE)
Enables log out after inactivity.
at line 183
int
getLogoutReason()
Why was user logged out?
at line 196
array
getRoles()
Returns a list of effective roles that a user has been granted.
at line 212
bool
isInRole($role)
Is a user in the specified effective role?
at line 225
bool
isAllowed($resource = IAuthorizator::ALL, $privilege = IAuthorizator::ALL)
Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.
at line 241
User
setAuthorizator(IAuthorizator $handler)
Sets authorization handler.
at line 252
IAuthorizator
getAuthorizator($need = TRUE)
Returns current authorization handler.