Public Member Functions | |
clearFlash () | |
Clear the list of pending notifications for this user. | |
clearSessionData ($key=null) | |
Clear session data for a given key, or all session data. | |
doc () | |
Return a documentation string about this class. | |
flash ($flash) | |
Add a notification to the user's flash (a shortcut to setFlash()). | |
getAttributes () | |
Get the names of all attributes for this object/entity. | |
getFlash () | |
Get the flash for this user. | |
getName () | |
Get the user's full name. | |
getSessionData ($key) | |
Fetch additional data stored in this user object (with a key). | |
getUniqueAttributes () | |
Get the list of unique attributes for this object (candidate keys). | |
isAdmin () | |
Check to see if a user has the ADMIN role. | |
isAnonymous () | |
Check to see if a user's role is ANONYMOUS. | |
issetSessionData ($key) | |
Check to see if session data is set for a certain key. | |
reset () | |
Reset the role of a user. | |
setFlash ($flash) | |
Add a notification to the user's flash. | |
setSessionData ($key, $value) | |
Save additional data into this user object (with a key). | |
Public Attributes | |
const | ADMIN |
Logged in as administrator, (i.e., full permissions). | |
const | ANONYMOUS |
Not currently logged in (i.e., no identity). | |
const | NOT_ACTIVE |
Means the user is not currently active in the system (not allowed to login). | |
Protected Attributes | |
$active | |
Whether or not the user is active (or disabled). | |
$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. |
This class can be used to represent a user and his/her personal data. It can be stored in the session (to follow the same user around to multiple different pages) and also written out to/ read from the database for storage.
The user object can keep data about the user's name, email, etc., the user's role (whether they are authenticated and with what level of permission), and also other small pieces of data that applications wish to store for a particular user. Finally, it stores a "flash" -- a set of pending messages to the user, generated by applications the user is using, that should be displayed to them on the screen at the next possible opportunity.
updated 6/17/07
updated 5/24/07
SUser::clearSessionData | ( | $ | key = null |
) |
Clear session data for a given key, or all session data.
If a key is passed, clear session data that has previously been stored for that key using setSessionData(). If no key is passed, clear all session data stored for this user.
$key | [string]: The name of session data to clear, or blank if all session data should be cleared. |
SUser::flash | ( | $ | flash | ) |
Add a notification to the user's flash (a shortcut to setFlash()).
$flash | [string]: The notification |
SUser::getAttributes | ( | ) |
Get the names of all attributes for this object/entity.
Return an array of all the instance variables for this object/entity that should be committed to the database when commit() is called on this object.
Reimplemented from SModel.
Reimplemented in CSERDUser, and SGlobalUser.
SUser::getFlash | ( | ) |
Get the flash for this user.
Get the list of notifications waiting to be displayed to this user
SUser::getName | ( | ) |
Get the user's full name.
Join the user's first and last names with a space
SUser::getSessionData | ( | $ | key | ) |
Fetch additional data stored in this user object (with a key).
Retrieve additional data stored in the user object using setSessionData().
$key | [string]: The name of the stored session data (i.e., scope.attribute) |
SUser::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 SModel.
Reimplemented in CSERDUser, and SGlobalUser.
SUser::isAdmin | ( | ) |
Check to see if a user has the ADMIN role.
SUser::isAnonymous | ( | ) |
Check to see if a user's role is ANONYMOUS.
SUser::issetSessionData | ( | $ | key | ) |
Check to see if session data is set for a certain key.
$key | [string]: A key to check for stored session data (i.e., scope.attribute) |
SUser::reset | ( | ) |
SUser::setFlash | ( | $ | flash | ) |
Add a notification to the user's flash.
Add a notification for the user that should be displayed to them onscreen. A controller will have to actively ask the user object for its flash and then print that flash to the screen.
$flash | [string]: The notification |
SUser::setSessionData | ( | $ | key, | |
$ | value | |||
) |
Save additional data into this user object (with a key).
Store additional data in this user object (instead of putting it directly into an index in the session). This data can be used to store things such as pages most recently viewed by the user. The data can be recalled later using getSessionData().
$key | [string]: The name of the session data to be stored. (i.e., scope.attribute) | |
$value | [mixed]: The value to be stored |