User
class User
User authentication and authorization.
Constants
deprecated MANUAL |
|
deprecated INACTIVITY |
|
LOGOUT_MANUAL |
Log-out reason |
LOGOUT_INACTIVITY |
Log-out reason |
Properties
string | $guestRole | ||
string | $authenticatedRole | ||
callable[] | $onLoggedIn | ||
callable[] | $onLoggedOut | ||
IAuthenticator | $authenticator | ||
Authorizator | $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
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 72
__construct(IUserStorage|null $legacyStorage = null, IAuthenticator|null $authenticator = null, Authorizator|null $authorizator = null, UserStorage|null $storage = null)
No description
at line 91
final UserStorage|IUserStorage
getStorage()
No description
at line 105
void
login(string|IIdentity $user, string|null $password = null)
Conducts the authentication process. Parameters are optional.
at line 136
final void
logout(bool $clearIdentity = false)
Logs out the user from the current session.
at line 162
final bool
isLoggedIn()
Is this user authenticated?
at line 175
final IIdentity|null
getIdentity()
Returns current user identity, if any.
at line 210
mixed
getId()
Returns current user ID, if any.
at line 217
final void
refreshStorage()
No description
at line 227
User
setAuthenticator(IAuthenticator $handler)
Sets authentication handler.
at line 237
final IAuthenticator|null
getAuthenticator()
Returns authentication handler.
at line 255
final IAuthenticator|null
getAuthenticatorIfExists()
Returns authentication handler.
at line 262
final bool
hasAuthenticator()
deprecated
deprecated
No description
at line 274
User
setExpiration(string|null $expire, int|bool $clearIdentity = null)
Enables log out after inactivity (like '20 minutes').
at line 296
final int|null
getLogoutReason()
Why was user logged out? Returns LOGOUT_MANUAL or LOGOUT_INACTIVITY.
at line 308
array
getRoles()
Returns a list of effective roles that a user has been granted.
at line 322
final bool
isInRole(string $role)
Is a user in the specified effective role?
at line 338
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 354
User
setAuthorizator(Authorizator $handler)
Sets authorization handler.
at line 364
final Authorizator|null
getAuthorizator()
Returns current authorization handler.
at line 382
final Authorizator|null
getAuthorizatorIfExists()
Returns current authorization handler.
at line 389
final bool
hasAuthorizator()
deprecated
deprecated
No description