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 () | |
Save this object to one row of its linked database entity. | |
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 () | |
Get the names of all attributes for this object/entity. | |
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 () | |
Get the list of unique attributes for this object (candidate keys). | |
isAuthenticated () | |
Check whether the user is authenticated to any realm. | |
isAuthenticatedFor ($realm) | |
Check whether a user is authenticated for a given realm. | |
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. |
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)
SGlobalUser::__construct | ( | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
Reimplemented from SObject.
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.
$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 |
SGlobalUser::commit | ( | ) |
Save this object to one row of its linked database entity.
Check to see whether this object has a primary key. If not, attempt to insert a new row into the linked database entity for this object. If so, attempt to update the row specified by the primary key.
Copy all the relevant attributes, listed by this object's getAttributes() function, to the database row.
If we have just inserted a new row of the table, set this object's primary key to the id of the new primary key generated by the database insert.
Reimplemented from SModel.
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)
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).
$realm | [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi') |
SGlobalUser::doc | ( | ) |
Return documentation for this class (for error messages).
Reimplemented from SUser.
SGlobalUser::getAttributes | ( | ) |
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.
$name | [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi') |
SGlobalUser::getEmail | ( | ) |
Fetch the user's email from the active authentication module.
SGlobalUser::getFirstName | ( | ) |
Fetch the user's first name from the active authentication module.
SGlobalUser::getLastName | ( | ) |
Fetch the user's last name from the active authentication module.
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')
$realm | [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi') |
SGlobalUser::getRole | ( | ) |
Fetch the user's role from the active authentication module.
SGlobalUser::getUniqueAttributes | ( | ) |
Get the list of unique attributes for this object (candidate keys).
Return a list of the unique attributes (candidate keys) for this object. The first item in this list must be the primary key. But you should theoretically be able to populate on any attribute in this list.
For most objects, this function will return a list with one element -- the string 'id'
Reimplemented from SUser.
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.
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.
$realm | [string]: The name of the realm (i.e., 'ldap', 'cserd', 'ncsi') |