Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • Ftp
  • Html
  • HttpContext
  • HttpRequest
  • HttpResponse
  • HttpUploadedFile
  • Session
  • SessionNamespace
  • Uri
  • UriScript
  • User

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • FtpException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class User

User authentication and authorization.

Nette\Object
Extended by Nette\Web\User implements Nette\Web\IUser
Namespace: Nette\Web
Author: David Grudl
Located at Web/User.php
Methods summary
public
# __construct( )
public
# login( string $username, string $password, mixed $extra = NULL )

Conducts the authentication process.

Conducts the authentication process.

Parameters

$username
string
$password
string
$extra
mixed

Throws

Nette\Security\AuthenticationException
if authentication was not successful

Implementation of

Nette\Web\IUser::login
final public
# logout( boolean $clearIdentity = FALSE )

Logs out the user from the current session.

Logs out the user from the current session.

Parameters

$clearIdentity
boolean
clear the identity from persistent storage?

Implementation of

Nette\Web\IUser::logout
final public boolean
# isLoggedIn( )

Is this user authenticated?

Is this user authenticated?

Returns

boolean

Implementation of

Nette\Web\IUser::isLoggedIn
final public Nette\Security\IIdentity
# getIdentity( )

Returns current user identity, if any.

Returns current user identity, if any.

Returns

Nette\Security\IIdentity

Implementation of

Nette\Web\IUser::getIdentity
public Nette\Web\User
# setAuthenticationHandler( Nette\Security\IAuthenticator $handler )

Sets authentication handler.

Sets authentication handler.

Parameters

$handler
Nette\Security\IAuthenticator

Returns

Nette\Web\User
provides a fluent interface

Implementation of

Nette\Web\IUser::setAuthenticationHandler
final public Nette\Security\IAuthenticator
# getAuthenticationHandler( )

Returns authentication handler.

Returns authentication handler.

Returns

Nette\Security\IAuthenticator

Implementation of

Nette\Web\IUser::getAuthenticationHandler
public Nette\Web\User
# setNamespace( string $namespace )

Changes namespace; allows more users to share a session.

Changes namespace; allows more users to share a session.

Parameters

$namespace
string

Returns

Nette\Web\User
provides a fluent interface

Implementation of

Nette\Web\IUser::setNamespace
final public string
# getNamespace( )

Returns current namespace.

Returns current namespace.

Returns

string

Implementation of

Nette\Web\IUser::getNamespace
public Nette\Web\User
# setExpiration( string|integer|DateTime $time, boolean $whenBrowserIsClosed = TRUE, boolean $clearIdentity = FALSE )

Enables log out after inactivity.

Enables log out after inactivity.

Parameters

$time
string|integer|DateTime
number of seconds or timestamp
$whenBrowserIsClosed
boolean
log out when the browser is closed?
$clearIdentity
boolean
clear the identity from persistent storage?

Returns

Nette\Web\User
provides a fluent interface
final public integer
# getLogoutReason( )

Why was user logged out?

Why was user logged out?

Returns

integer
protected Nette\Web\SessionNamespace
# getSessionNamespace( $need )

Returns and initializes $this->session.

Returns and initializes $this->session.

Returns

Nette\Web\SessionNamespace
protected Nette\Web\User
# setAuthenticated( boolean $state )

Sets the authenticated status of this user.

Sets the authenticated status of this user.

Parameters

$state
boolean
flag indicating the authenticated status of user

Returns

Nette\Web\User
provides a fluent interface
protected Nette\Web\User
# setIdentity( Nette\Security\IIdentity $identity = NULL )

Sets the user identity.

Sets the user identity.

Parameters

$identity
Nette\Security\IIdentity

Returns

Nette\Web\User
provides a fluent interface
public array
# getRoles( )

Returns a list of effective roles that a user has been granted.

Returns a list of effective roles that a user has been granted.

Returns

array

Implementation of

Nette\Web\IUser::getRoles
final public boolean
# isInRole( string $role )

Is a user in the specified effective role?

Is a user in the specified effective role?

Parameters

$role
string

Returns

boolean

Implementation of

Nette\Web\IUser::isInRole
public boolean
# isAllowed( string $resource = Nette\Security\IAuthorizator::ALL, string $privilege = Nette\Security\IAuthorizator::ALL )

Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.

Has a user effective access to the Resource? If $resource is NULL, then the query applies to all resources.

Parameters

$resource
string
resource
$privilege
string
privilege

Returns

boolean

Implementation of

Nette\Web\IUser::isAllowed
public Nette\Web\User
# setAuthorizationHandler( Nette\Security\IAuthorizator $handler )

Sets authorization handler.

Sets authorization handler.

Parameters

$handler
Nette\Security\IAuthorizator

Returns

Nette\Web\User
provides a fluent interface

Implementation of

Nette\Web\IUser::setAuthorizationHandler
final public Nette\Security\IAuthorizator
# getAuthorizationHandler( )

Returns current authorization handler.

Returns current authorization handler.

Returns

Nette\Security\IAuthorizator

Implementation of

Nette\Web\IUser::getAuthorizationHandler
protected Nette\Web\Session
# getSession( )

Returns session handler.

Returns session handler.

Returns

Nette\Web\Session
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
integer MANUAL 1
#

log-out reason Nette\Web\User::getLogoutReason()

log-out reason Nette\Web\User::getLogoutReason()

integer INACTIVITY 2
#
integer BROWSER_CLOSED 3
#
Properties summary
public string $guestRole 'guest'
#

default role for unauthenticated user

default role for unauthenticated user

public string $authenticatedRole 'authenticated'
#

default role for authenticated user without own identity

default role for authenticated user without own identity

public array $onLoggedIn
#

of function(User $sender); Occurs when the user is successfully logged in

of function(User $sender); Occurs when the user is successfully logged in

public array $onLoggedOut
#

of function(User $sender); Occurs when the user is logged out

of function(User $sender); Occurs when the user is logged out

Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0