Packages

  • Nette
    • Application
      • Application\Diagnostics
      • Application\Responses
      • Application\Routers
      • Application\UI
    • Caching
      • Caching\Storages
    • ComponentModel
    • Config
    • Database
      • Database\Diagnostics
      • Database\Drivers
      • Database\Reflection
      • Database\Table
    • DI
    • Diagnostics
    • Forms
      • Forms\Controls
      • Forms\Rendering
    • Http
    • Iterators
    • Latte
      • Latte\Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • None
  • PHP

Classes

  • NHttpContext
  • NHttpRequest
  • NHttpRequestFactory
  • NHttpResponse
  • NHttpUploadedFile
  • NSession
  • NSessionSection
  • NUrl
  • NUrlScript
  • NUser

Interfaces

  • IHttpRequest
  • IHttpResponse
  • ISessionStorage
  • IUser
  • Overview
  • Package
  • Class
  • Tree

Class NUser

User authentication and authorization.

NObject
Extended by NUser implements IUser
Package: Nette\Http
Author: David Grudl
Located at Http/User.php
Methods summary
public
# __construct( IDIContainer $context )
public
# login( mixed $username = NULL, mixed $password = NULL )

Conducts the authentication process. Parameters are optional.

Conducts the authentication process. Parameters are optional.

Parameters

$username
mixed
optional parameter (e.g. username)
$password
mixed
optional parameter (e.g. password)

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 mixed
# getId( )

Returns current user ID, if any.

Returns current user ID, if any.

Returns

mixed
public NUser
# setAuthenticator( IAuthenticator $handler )

Sets authentication handler.

Sets authentication handler.

Parameters

$handler
IAuthenticator

Returns

NUser
provides a fluent interface

Implementation of

IUser::setAuthenticator
final public IAuthenticator
# getAuthenticator( )

Returns authentication handler.

Returns authentication handler.

Returns

IAuthenticator

Implementation of

IUser::getAuthenticator
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 NSessionSection
# getSessionSection( $need )

Returns and initializes $this->session.

Returns and initializes $this->session.

Returns

NSessionSection
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
# setAuthorizator( IAuthorizator $handler )

Sets authorization handler.

Sets authorization handler.

Parameters

$handler
IAuthorizator

Returns

NUser
provides a fluent interface

Implementation of

IUser::setAuthorizator
final public IAuthorizator
# getAuthorizator( )

Returns current authorization handler.

Returns current authorization handler.

Returns

IAuthorizator

Implementation of

IUser::getAuthorizator
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
#

log-out reason NUser::getLogoutReason()

log-out reason NUser::getLogoutReason()

integer BROWSER_CLOSED 3
#

log-out reason NUser::getLogoutReason()

log-out reason NUser::getLogoutReason()

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 2.0beta1 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0