Common
[ class tree: Common ] [ index: Common ] [ all elements ]

Class: SecurityManager

Source Location: /common/SecurityManager.php

Class Overview


Class which manages security in Cartoweb


Variables

Constants

Methods



Class Details

[line 61]
Class which manages security in Cartoweb

It is used to authenticate a username/password pair, and handle the roles associated to a user. This class has only one instance available at any time, using getInstance static method.

Once the user is authenticated, it is made known the this manager through setUser or setUserAndRoles. From there on, security checks can be done using hasRole method.




[ Top ]


Class Variables

$instance =

[line 92]

Singleton



Tags:

static:  
access:  private

Type:   SecurityManager


[ Top ]

$roles =

[line 79]

The list of roles associated to the current authenticated user.



Tags:

access:  private

Type:   array


[ Top ]

$securityContainer =

[line 67]

Current security container



Tags:

access:  private

Type:   SecurityContainer


[ Top ]

$username =  ''

[line 73]

The current authenticated username, or empty if none.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 97]

SecurityManager __construct( )

Constructor



Tags:

access:  public


[ Top ]

method checkUser [line 151]

boolean checkUser( string $username, string $password)

Check if a username, password pair is valid.



Tags:

return:  true if the pair is valid.
access:  public


Parameters:

string   $username   the username
string   $password   its password

[ Top ]

method clearSecurityContainer [line 140]

void clearSecurityContainer( )

Removes the current SecurityConainer. No user will be authenticated since then.



Tags:

access:  public


[ Top ]

method getInstance [line 106]

void getInstance( )

Returns the instance of this class. There is only one during the cartoclient/server lifetime.



Tags:

static:  
access:  public


[ Top ]

method getPredefinedRoles [line 117]

void getPredefinedRoles( boolean $anonymous)

Returns the pre-defined roles for a user.



Tags:

access:  private


Parameters:

boolean   $anonymous   true if we want the roles for an anomymous user.

[ Top ]

method getRoles [line 203]

array getRoles( )



Tags:

return:  Returns the current roles associated to the current user.
access:  public


[ Top ]

method getUser [line 196]

string getUser( )



Tags:

return:  Returns the current authenticated username
access:  public


[ Top ]

method hasRole [line 215]

boolean hasRole( mixed $roles)

Check if the current user has the given role, or at least one role among the one given, if it is an array.



Tags:

return:  true if the user has the given role, or at least on of them.
access:  public


[ Top ]

method setSecurityContainer [line 132]

void setSecurityContainer( SecurityContainer $securityContainer)

Sets the current SecurityContainer database



Tags:

access:  public


Parameters:

SecurityContainer   $securityContainer   new SecurityContainer to set.

[ Top ]

method setUser [line 183]

void setUser( string $username)

Sets the current authenticated user. Its roles will be fetched from the

current SecurityContainer Warning: for client plugins managing authentication, the setUser() or setUserAndRoles() MUST be called before or in the initialize() Plugin method. Otherwise, security constraints could be bypassed.




Tags:

access:  public


Parameters:

string   $username   the authenticated username

[ Top ]

method setUserAndRoles [line 165]

void setUserAndRoles( string $username, array $roles)

Sets the username and its associated roles for the current authenticated user.

Warning: Please see the #setUser() note about client plugins.




Tags:

access:  public


Parameters:

string   $username   the authenticated username
array   $roles   the list of associated roles of the user

[ Top ]


Class Constants

ALL_ROLE =  'all'

[line 84]

Constants for pre-defined roles.


[ Top ]

ANONYMOUS_ROLE =  'anonymous'

[line 85]


[ Top ]

LOGGED_IN_ROLE =  'loggedIn'

[line 86]


[ Top ]



Documentation generated on Fri, 21 Sep 2007 13:31:01 +0200 by phpDocumentor 1.3.0RC3