Packages

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

Classes

  • NFtp
  • NHtml
  • NHttpContext
  • NHttpRequest
  • NHttpResponse
  • NHttpUploadedFile
  • NSession
  • NSessionNamespace
  • NUri
  • NUriScript
  • NUser

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • NFtpException
  • Overview
  • Package
  • Class
  • Tree
  • Other releases

Class NUser

User authentication and authorization.

NObject
Extended by NUser implements IUser
Package: 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

NAuthenticationException
if authentication was not successful

Implementation of

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

IUser::logout
final public boolean
# isLoggedIn( )

Is this user authenticated?

Is this user authenticated?

Returns

boolean

Implementation of

IUser::isLoggedIn
final public IIdentity
# getIdentity( )

Returns current user identity, if any.

Returns current user identity, if any.

Returns

IIdentity

Implementation of

IUser::getIdentity
public NUser
# setAuthenticationHandler( IAuthenticator $handler )

Sets authentication handler.

Sets authentication handler.

Parameters

$handler
IAuthenticator

Returns

NUser
provides a fluent interface

Implementation of

IUser::setAuthenticationHandler
final public IAuthenticator
# getAuthenticationHandler( )

Returns authentication handler.

Returns authentication handler.

Returns

IAuthenticator

Implementation of

IUser::getAuthenticationHandler
public NUser
# 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

NUser
provides a fluent interface

Implementation of

IUser::setNamespace
final public string
# getNamespace( )

Returns current namespace.

Returns current namespace.

Returns

string

Implementation of

IUser::getNamespace
public NUser
# 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

NUser
provides a fluent interface
final public integer
# getLogoutReason( )

Why was user logged out?

Why was user logged out?

Returns

integer
protected NSessionNamespace
# getSessionNamespace( $need )

Returns and initializes $this->session.

Returns and initializes $this->session.

Returns

NSessionNamespace
protected NUser
# 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

NUser
provides a fluent interface
protected NUser
# setIdentity( IIdentity $identity = NULL )

Sets the user identity.

Sets the user identity.

Parameters

$identity
IIdentity

Returns

NUser
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

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

IUser::isInRole
public boolean
# isAllowed( string $resource = IAuthorizator::ALL, string $privilege = 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

IUser::isAllowed
public NUser
# setAuthorizationHandler( IAuthorizator $handler )

Sets authorization handler.

Sets authorization handler.

Parameters

$handler
IAuthorizator

Returns

NUser
provides a fluent interface

Implementation of

IUser::setAuthorizationHandler
final public IAuthorizator
# getAuthorizationHandler( )

Returns current authorization handler.

Returns current authorization handler.

Returns

IAuthorizator

Implementation of

IUser::getAuthorizationHandler
protected NSession
# getSession( )

Returns session handler.

Returns session handler.

Returns

NSession
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
integer MANUAL 1
#

log-out reason NUser::getLogoutReason()

log-out reason NUser::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 (for PHP 5.2) API documentation generated by ApiGen 2.3.0