User
class User
User authentication and authorization.
Constants
LogoutManual |
Log-out reason |
LogoutInactivity |
Log-out reason |
LOGOUT_MANUAL |
|
MANUAL |
|
LOGOUT_INACTIVITY |
|
INACTIVITY |
|
Properties
$guestRole | default role for unauthenticated user |
||
$authenticatedRole | default role for authenticated user without own identity |
||
$onLoggedIn | |||
$onLoggedOut | |||
bool | $loggedIn | ||
IIdentity | $identity |
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.
No description
Returns authentication handler.
Returns authentication handler.
Enables log out after inactivity (like '20 minutes').
Why was user logged out? Returns LOGOUT_MANUAL or LOGOUT_INACTIVITY.
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.
Returns current authorization handler.
Details
at line 66
__construct(UserStorage $storage, Authenticator|null $authenticator = null, Authorizator|null $authorizator = null)
No description
at line 74
final UserStorage
getStorage()
No description
at line 88
void
login(IIdentity $username, string|null $password = null)
Conducts the authentication process. Parameters are optional.
at line 116
final void
logout(bool $clearIdentity = false)
Logs out the user from the current session.
at line 133
final bool
isLoggedIn()
Is this user authenticated?
at line 146
final IIdentity|null
getIdentity()
Returns current user identity, if any.
at line 174
string|int|null
getId()
Returns current user ID, if any.
at line 181
final void
refreshStorage()
No description
at line 190
User
setAuthenticator(Authenticator $handler)
Sets authentication handler.
at line 200
final Authenticator
getAuthenticator()
Returns authentication handler.
at line 213
final Authenticator|null
getAuthenticatorIfExists()
Returns authentication handler.
at line 220
final bool
hasAuthenticator()
deprecated
deprecated
No description
at line 229
setExpiration(string|null $expire, bool $clearIdentity = false)
Enables log out after inactivity (like '20 minutes').
at line 239
final int|null
getLogoutReason()
Why was user logged out? Returns LOGOUT_MANUAL or LOGOUT_INACTIVITY.
at line 251
array
getRoles()
Returns a list of effective roles that a user has been granted.
at line 265
final bool
isInRole(string $role)
Is a user in the specified effective role?
at line 281
bool
isAllowed($resource = Authorizator::All, $privilege = Authorizator::All)
Has a user effective access to the Resource? If $resource is null, then the query applies to all resources.
at line 296
User
setAuthorizator(Authorizator $handler)
Sets authorization handler.
at line 306
final Authorizator
getAuthorizator()
Returns current authorization handler.
at line 319
final Authorizator|null
getAuthorizatorIfExists()
Returns current authorization handler.
at line 326
final bool
hasAuthorizator()
deprecated
deprecated
No description