SGlobalUser Class Reference

The global user object, stored in the session and accessible from all projects. More...

Inheritance diagram for SGlobalUser:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ()
 INSERT BRIEF DESCRIPTION HERE.
 authenticateWith ($realm, $username, $password)
 Attempt to authenticate the user to a named realm using the given credentials.
 commit ()
 deAuthenticateAll ()
 De-authenticate a user from all realms.
 deAuthenticateFor ($realm)
 De-authenticate a user from the named realm.
 doc ()
 Return documentation for this class (for error messages).
 getAttributes ()
 getAuthModule ($name)
 Get an authentication module, based on the name of its realm.
 getEmail ()
 Fetch the user's email from the active authentication module.
 getFirstName ()
 Fetch the user's first name from the active authentication module.
 getLastName ()
 Fetch the user's last name from the active authentication module.
 getRealmClassName ($realm)
 Get the name of the authentication module for a given realm.
 getRole ()
 Fetch the user's role from the active authentication module.
 getUniqueAttributes ()
 isAuthenticated ()
 Check whether the user is authenticated to any realm.
 isAuthenticatedFor ($realm)
 Check whether a user is authenticated for a given realm.
 populate ()

Protected Member Functions

 addAuthRealm ($realm, $mod, $username)
 Add an authenticated realm to this object.

Protected Attributes

 $firstName
 The first name of the user as a string.
 $flash
 The list of messages waiting to be displayed to the user.
 $id
 The user's id for persistant storage -- i.e., database primary key.
 $lastName
 The last name of the user as a string.
 $role
 The user's current role (changes based on their login status).
 $sessionData
 Misc session data stored for this user by web app controllers.
 $userName
 The username of the user for login.


Detailed Description

The global user object, stored in the session and accessible from all projects.

The global user object represents a user of the Shodor website. An instance of the object is created and stored in the session of each new user visiting a Shodor site. This object then follows a user from project to project and keeps track of their authentication realms -- for what realms within Shodor they have successfully signed in.

Projects can ask for this global authentication information, for example to decide what roles to grant the user within the project.

The global user object also stores a global username and name to the user (assigned at time of authentication to the first auth realm)

Author:
Jonathan <jwsm@shodor.org> (5/4/07) Last Updated: 11/28/07 Updated: 6/24/07 Updated: 6/17/07

Definition at line 22 of file SGlobalUser.php5.


Constructor & Destructor Documentation

SGlobalUser::__construct (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SObject.

Definition at line 39 of file SGlobalUser.php5.


Member Function Documentation

SGlobalUser::addAuthRealm ( realm,
mod,
username 
) [protected]

Add an authenticated realm to this object.

For internal use only.

Add a successfully authenticated auth module to this object's array of auth realms.

Parameters:
$realm [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')
$mod [SAuthModule]: The auth module, a subclass of SAuthModule
$username [string]: The username used to authenticate to this realm (depricated)

Definition at line 270 of file SGlobalUser.php5.

Referenced by authenticateWith().

SGlobalUser::authenticateWith ( realm,
username,
password 
)

Attempt to authenticate the user to a named realm using the given credentials.

Attempt to authenticate the user to a named realm (i.e., 'ldap', 'cserd', 'ncsi'), given the username and password provided. If the user's credentials are valid, add the realm to this global user's list of successfully authenticated realms and return true. Otherwise, return false.

Parameters:
$realm [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')
$username [string]: The username with which to authenticate the user
$password [TYPE]: The password with which to authenticate the user
Returns:
[bool]: True if authentication succeeds, false if it fails

Definition at line 192 of file SGlobalUser.php5.

References addAuthRealm(), getRealmClassName(), and SObject::setPrettyWarning().

SGlobalUser::commit (  ) 

For internal use only.

Cannot commit this object

Reimplemented from SModel.

Definition at line 80 of file SGlobalUser.php5.

SGlobalUser::deAuthenticateAll (  ) 

De-authenticate a user from all realms.

Reset our list of successfully authenticated realms to be blank (i.e., logout of all realms)

Definition at line 238 of file SGlobalUser.php5.

SGlobalUser::deAuthenticateFor ( realm  ) 

De-authenticate a user from the named realm.

If a user is authenticated to the specified realm, remove it from our list of successfully authenticated realms (i.e., logout of that realm, but not others).

Parameters:
$realm [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')

Definition at line 229 of file SGlobalUser.php5.

SGlobalUser::doc (  ) 

Return documentation for this class (for error messages).

Returns:
[string]: documentation about this class

Reimplemented from SUser.

Definition at line 49 of file SGlobalUser.php5.

SGlobalUser::getAttributes (  ) 

For internal use only.

Reimplemented from SUser.

Definition at line 57 of file SGlobalUser.php5.

SGlobalUser::getAuthModule ( name  ) 

Get an authentication module, based on the name of its realm.

For any realm that we are successfully authenticated within, get the auth module used to do the authentication.

Parameters:
$name [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')
Returns:
[SAuthModule]: The authentication module, a subclass of SAuthModule

Definition at line 286 of file SGlobalUser.php5.

SGlobalUser::getEmail (  ) 

Fetch the user's email from the active authentication module.

Returns:
[string]: The user's email

Definition at line 123 of file SGlobalUser.php5.

References SUser::reset().

SGlobalUser::getFirstName (  ) 

Fetch the user's first name from the active authentication module.

Returns:
[string]: The user's first name

Definition at line 93 of file SGlobalUser.php5.

References SUser::reset().

SGlobalUser::getLastName (  ) 

Fetch the user's last name from the active authentication module.

Returns:
[string]: The user's last name

Definition at line 108 of file SGlobalUser.php5.

References SUser::reset().

SGlobalUser::getRealmClassName ( realm  ) 

Get the name of the authentication module for a given realm.

Return the name of the expected authentication module class as a string. All auth modules are named based on their realm as follows: 'ldap' => 'SLdapAuthModule' ('S' + upper-case-first realm + 'AuthModule')

Parameters:
$realm [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')

Definition at line 254 of file SGlobalUser.php5.

Referenced by authenticateWith().

SGlobalUser::getRole (  ) 

Fetch the user's role from the active authentication module.

Returns:
[string]: The string describing the user's global role

Definition at line 135 of file SGlobalUser.php5.

References SUser::reset().

SGlobalUser::getUniqueAttributes (  ) 

For internal use only.

Reimplemented from SUser.

Definition at line 64 of file SGlobalUser.php5.

SGlobalUser::isAuthenticated (  ) 

Check whether the user is authenticated to any realm.

Return true if the user has successfully authenticated to at least one realm, and false otherwise.

Returns:
[bool]: True if the user is authenticated for at least one realm

Definition at line 175 of file SGlobalUser.php5.

SGlobalUser::isAuthenticatedFor ( realm  ) 

Check whether a user is authenticated for a given realm.

Check to see whether a user has logged in successfully under a given authentication realm. Return true if the requested realm is found under the list of successfully authenticated realms.

Parameters:
$realm [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi')
Returns:
[bool]: True if the user is authenticated, false if not

Definition at line 159 of file SGlobalUser.php5.

SGlobalUser::populate (  ) 

For internal use only.

Cannot populate this object

Definition at line 72 of file SGlobalUser.php5.


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:06:13 2010 for Common by  doxygen 1.5.6