Namespaces

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

Classes

  • Context
  • FileUpload
  • Request
  • RequestFactory
  • Response
  • Session
  • SessionSection
  • Url
  • UrlScript
  • User

Interfaces

  • IRequest
  • IResponse
  • ISessionStorage
  • IUser
  • Overview
  • Namespace
  • Class
  • Tree

Class User

User authentication and authorization.

Nette\Object
Extended by Nette\Http\User implements Nette\Http\IUser
Namespace: Nette\Http
Author: David Grudl
Located at Http/User.php
Methods summary
public
# __construct( Nette\DI\IContainer $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

Nette\Security\AuthenticationException
if authentication was not successful

Implementation of

Nette\Http\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\Http\IUser::logout
final public boolean
# isLoggedIn( )

Is this user authenticated?

Is this user authenticated?

Returns

boolean

Implementation of

Nette\Http\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\Http\IUser::getIdentity
public mixed
# getId( )

Returns current user ID, if any.

Returns current user ID, if any.

Returns

mixed
public Nette\Http\User
# setAuthenticator( Nette\Security\IAuthenticator $handler )

Sets authentication handler.

Sets authentication handler.

Parameters

$handler
Nette\Security\IAuthenticator

Returns

Nette\Http\User
provides a fluent interface

Implementation of

Nette\Http\IUser::setAuthenticator
final public Nette\Security\IAuthenticator
# getAuthenticator( )

Returns authentication handler.

Returns authentication handler.

Returns

Nette\Security\IAuthenticator

Implementation of

Nette\Http\IUser::getAuthenticator
public Nette\Http\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\Http\User
provides a fluent interface

Implementation of

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

Returns current namespace.

Returns current namespace.

Returns

string

Implementation of

Nette\Http\IUser::getNamespace
public Nette\Http\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\Http\User
provides a fluent interface
final public integer
# getLogoutReason( )

Why was user logged out?

Why was user logged out?

Returns

integer
protected Nette\Http\SessionSection
# getSessionSection( $need )

Returns and initializes $this->session.

Returns and initializes $this->session.

Returns

Nette\Http\SessionSection
protected Nette\Http\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\Http\User
provides a fluent interface
protected Nette\Http\User
# setIdentity( Nette\Security\IIdentity $identity = NULL )

Sets the user identity.

Sets the user identity.

Parameters

$identity
Nette\Security\IIdentity

Returns

Nette\Http\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\Http\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\Http\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\Http\IUser::isAllowed
public Nette\Http\User
# setAuthorizator( Nette\Security\IAuthorizator $handler )

Sets authorization handler.

Sets authorization handler.

Parameters

$handler
Nette\Security\IAuthorizator

Returns

Nette\Http\User
provides a fluent interface

Implementation of

Nette\Http\IUser::setAuthorizator
final public Nette\Security\IAuthorizator
# getAuthorizator( )

Returns current authorization handler.

Returns current authorization handler.

Returns

Nette\Security\IAuthorizator

Implementation of

Nette\Http\IUser::getAuthorizator
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
integer MANUAL 1
#

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

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

integer INACTIVITY 2
#

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

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

integer BROWSER_CLOSED 3
#

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

log-out reason Nette\Http\User::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 API API documentation generated by ApiGen 2.3.0