
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 () | |
| 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 () | |
| 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
Definition at line 22 of file SUser.php5.
| 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. |
Definition at line 156 of file SUser.php5.
References SObject::setPrettyWarning().
| SUser::flash | ( | $ | flash | ) |
Add a notification to the user's flash (a shortcut to setFlash()).
| $flash | [string]: The notification |
Definition at line 93 of file SUser.php5.
References $flash, and setFlash().
Referenced by clearFlash(), getFlash(), and setFlash().
| SUser::getAttributes | ( | ) |
For internal use only.
Reimplemented from SModel.
Reimplemented in CSERDUser, and SGlobalUser.
Definition at line 61 of file SUser.php5.
| SUser::getFlash | ( | ) |
Get the flash for this user.
Get the list of notifications waiting to be displayed to this user
Definition at line 104 of file SUser.php5.
References flash().
| SUser::getName | ( | ) |
Get the user's full name.
Join the user's first and last names with a space
Definition at line 186 of file SUser.php5.
| 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) |
Definition at line 138 of file SUser.php5.
References SObject::setPrettyWarning().
| SUser::getUniqueAttributes | ( | ) |
For internal use only.
Reimplemented from SModel.
Reimplemented in CSERDUser, and SGlobalUser.
Definition at line 68 of file SUser.php5.
| SUser::isAdmin | ( | ) |
Check to see if a user has the ADMIN role.
Definition at line 214 of file SUser.php5.
References ADMIN.
Referenced by CSERDUser::hasEditor().
| SUser::isAnonymous | ( | ) |
Check to see if a user's role is ANONYMOUS.
Definition at line 205 of file SUser.php5.
References 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) |
Definition at line 175 of file SUser.php5.
| SUser::reset | ( | ) |
Reset the role of a user.
Reset a user's role to ANONYMOUS, i.e., log them out of any role they currently have.
Reimplemented from SModel.
Reimplemented in CSERDUser.
Definition at line 195 of file SUser.php5.
References ANONYMOUS.
Referenced by SGlobalUser::getEmail(), SGlobalUser::getFirstName(), SGlobalUser::getLastName(), and SGlobalUser::getRole().
| 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 |
Definition at line 84 of file SUser.php5.
References $flash, and flash().
Referenced by flash().
| 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 |
Definition at line 126 of file SUser.php5.
1.5.6