Class User (namespace Nette\Web)
Authentication and authorization.
Object | --User
Implements interfaces:
Public Method Summary | |
---|---|
void |
authenticate
(string $username, string $password, [mixed $extra =
NULL ])
Conducts the authentication process.
|
IAuthenticator |
Returns authentication handler.
|
IAuthorizator |
Returns current authorization handler.
|
IIdentity |
getIdentity
()
Returns current user identity, if any.
|
string |
getNamespace
()
Returns current namespace.
|
array |
getRoles
()
Returns a list of effective roles that a user has been granted.
|
int |
Why was user signed out?
|
bool |
Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.
|
bool |
Is this user authenticated?
|
bool |
isInRole
(string $role)
Is a user in the specified effective role?
|
User |
setAuthenticationHandler
($handler)
Sets authentication handler.
|
User |
setAuthorizationHandler
($handler)
Sets authorization handler.
|
User |
Enables sign out after inactivity.
|
User |
setNamespace
(string $namespace)
Changes namespace; allows more users to share a session.
|
void |
signOut
([bool $clearIdentity =
FALSE ])
Logs off the user from the current session.
|
Protected Method Summary | |
---|---|
protected Session |
getSession
()
Returns session handler.
|
protected SessionNamespace |
getSessionNamespace
($need)
Returns and initializes $this->session.
|
protected User |
setAuthenticated
(bool $state)
Sets the authenticated status of this user.
|
protected User |
setIdentity
([$identity =
NULL ])
Sets the user identity.
|
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
int | BROWSER_CLOSED |
3 |
line 47 sign-out reason User::getSignOutReason() |
int | INACTIVITY |
2 |
line 46 sign-out reason User::getSignOutReason() |
int | MANUAL |
1 |
line 45 sign-out reason User::getSignOutReason() |
Variable Summary | ||||
---|---|---|---|---|
string | $authenticatedRole | 'authenticated' |
line 54 default role for authenticated user without own identity |
|
string | $guestRole | 'guest' |
line 51 default role for unauthenticated user |
|
array | $onAuthenticated |
|
line 57 of function(User $sender); Occurs when the user is successfully authenticated |
|
array | $onSignedOut |
|
line 60 of function(User $sender); Occurs when the user is logged off |
Method Details | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 88 authenticatepublic void authenticate (string $username, string $password, [mixed $extra = Conducts the authentication process. Implementation of:
|
||||||||||||||||||||||||
line 170 getAuthenticationHandlerpublic IAuthenticator getAuthenticationHandler () Returns authentication handler. Implementation of:
|
||||||||||||||||||||||||
line 416 getAuthorizationHandlerpublic IAuthorizator getAuthorizationHandler () Returns current authorization handler. Implementation of:
|
||||||||||||||||||||||||
line 145 getIdentitypublic IIdentity getIdentity () Returns current user identity, if any. Implementation of:
|
||||||||||||||||||||||||
line 200 getNamespacepublic string getNamespace () Returns current namespace. Implementation of:
|
||||||||||||||||||||||||
line 352 getRolespublic array getRoles () Returns a list of effective roles that a user has been granted. Implementation of:
|
||||||||||||||||||||||||
line 434 getSessionprotected Session getSession () Returns session handler.
|
||||||||||||||||||||||||
line 257 getSessionNamespaceprotected SessionNamespace getSessionNamespace ($need) Returns and initializes $this->session.
|
||||||||||||||||||||||||
line 245 getSignOutReasonpublic int getSignOutReason () Why was user signed out?
|
||||||||||||||||||||||||
line 383 isAllowedpublic bool isAllowed ([string $resource = Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources. Implementation of:
|
||||||||||||||||||||||||
line 133 isAuthenticatedpublic bool isAuthenticated () Is this user authenticated? Implementation of:
|
||||||||||||||||||||||||
line 369 isInRolepublic bool isInRole (string $role) Is a user in the specified effective role? Implementation of:
|
||||||||||||||||||||||||
line 310 setAuthenticatedprotected User setAuthenticated (bool $state) Sets the authenticated status of this user.
|
||||||||||||||||||||||||
line 158 setAuthenticationHandlerpublic User setAuthenticationHandler ($handler) Sets authentication handler. Implementation of:
|
||||||||||||||||||||||||
line 404 setAuthorizationHandlerpublic User setAuthorizationHandler ($handler) Sets authorization handler. Implementation of:
|
||||||||||||||||||||||||
line 214 setExpirationpublic User setExpiration (mixed $seconds, [bool $whenBrowserIsClosed = Enables sign out after inactivity.
|
||||||||||||||||||||||||
line 336 setIdentityprotected User setIdentity ([$identity = Sets the user identity.
|
||||||||||||||||||||||||
line 185 setNamespacepublic User setNamespace (string $namespace) Changes namespace; allows more users to share a session. Implementation of:
|
||||||||||||||||||||||||
line 115 signOutpublic void signOut ([bool $clearIdentity = Logs off the user from the current session. Implementation of:
|