CWIS Developer Documentation
|
CWIS-specific user class. More...
Public Member Functions | |
__construct ($UserInfo=NULL) | |
Load user data from the given user info or from the session if available. More... | |
Login ($UserName, $Password, $IgnorePassword=FALSE) | |
Log the specified user in and associate the underlying Resource with this CWUser. More... | |
Logout () | |
Log this user out and disassociate their underlying Resource from this CWUser. More... | |
Privileges (PrivilegeSet $NewValue=NULL) | |
THIS FUNCTION HAS BEEN DEPRECATED This provides compatibility for interfaces written to use a version of PrivilegeSet from CWIS 3.0.0 to 3.1.0. More... | |
ResourceId () | |
Get the ID of the user resource associated with the user. More... | |
GetResource () | |
Get the associated user resource for this user. More... | |
HasPriv ($Privilege, $Privileges=NULL) | |
Determine if a user has a given privilege, or satisfies the conditions specified by a given privilege set. More... | |
GrantPriv ($Privilege) | |
Grant privilege to a a user. More... | |
SetPrivList ($NewPrivileges) | |
Clear current user privs and replace them with the specified list. More... | |
Delete () | |
Delete the user and its associated user resource. More... | |
Get ($FieldName) | |
Get a value from the specified field. More... | |
Set ($Field, $NewValue) | |
Set a value for the specified field. More... | |
![]() | |
__construct ($UserInfoOne=NULL, $UserInfoTwo=NULL) | |
Status () | |
StatusMessage () | |
Delete () | |
Id () | |
Name () | |
GetBestName () | |
Get the best available name associated with a user, i.e., the real name or, if it isn't available, the user name. More... | |
LastLocation ($NewLocation=NULL) | |
LastActiveDate () | |
LastIPAddress () | |
Get ($FieldName) | |
GetDate ($FieldName, $Format="") | |
Set ($FieldName, $NewValue) | |
Login ($UserName, $Password, $IgnorePassword=FALSE) | |
Logout () | |
GetPasswordSalt ($UserName) | |
IsLoggedIn () | |
Report whether user is currently logged in. More... | |
IsNotLoggedIn () | |
Report whether user is not currently logged in. More... | |
IsAnonymous () | |
Report whether user is anonymous user. More... | |
ChangePassword ($OldPassword, $NewPassword, $NewPasswordAgain) | |
Check provided password and set a new one if it war correct. More... | |
SetPassword ($NewPassword) | |
SetEncryptedPassword ($NewEncryptedPassword) | |
GetActivationCode () | |
IsActivationCodeGood ($Code) | |
IsActivated ($NewValue=DB_NOVALUE) | |
GetResetCode () | |
IsResetCodeGood ($Code) | |
GetMailChangeCode () | |
IsMailChangeCodeGood ($Code) | |
SendEMail ($TemplateTextOrFileName, $FromAddress=NULL, $MoreSubstitutions=NULL, $ToAddress=NULL) | |
HasPriv ($Privilege, $Privileges=NULL) | |
Check whether user has specified privilege(s). More... | |
GrantPriv ($Privilege) | |
RevokePriv ($Privilege) | |
GetPrivList () | |
SetPrivList ($NewPrivileges) | |
GetUniqueCode ($SeedString, $CodeLength) | |
GetRandomPassword ($PasswordMinLength=6, $PasswordMaxLength=8) | |
UpdateValue ($FieldName, $NewValue=DB_NOVALUE) | |
GivePriv ($Privilege) | |
Static Public Member Functions | |
static | EmailWrapper ($To, $Subject, $Message, $AdditionalHeaders) |
Adapter method to bridge between User class and Email class. More... | |
static | GetCustomUserFields () |
Get all custom user fields. More... | |
static | GetDefaultUserFields () |
Get the default user fields. More... | |
![]() | |
static | GetStatusMessageForCode ($StatusCode) |
Get text error message for a specified error code. More... | |
static | SetEmailFunction ($NewValue) |
Set email function to use instead of mail(). More... | |
static | GetSqlQueryForUsersWithPriv ($Privilege, $Privileges=NULL) |
Get an SQL query that will return IDs of all users that have the specified privilege flags. More... | |
static | GetSqlQueryForUsersWithoutPriv ($Privilege, $Privileges=NULL) |
Get an SQL query that will return IDs of all users that do not have the specified privilege flags. More... | |
static | GetAnonymousUser () |
Get the anonymous user (i.e., the User object that exists when no user is logged in), useful when a permission check needs to know if something should be visible to the general public. More... | |
static | IsValidUserName ($UserName) |
static | IsValidPassword ($Password, $UserName, $Email) |
static | CheckPasswordForErrors ($Password, $UserName=NULL, $Email=NULL) |
Determine if a provided password complies with the configured rules, optionally checking that it does not contain a specified username or email. More... | |
static | IsValidLookingEMailAddress ($EMail) |
static | NormalizeEMailAddress ($EMailAddress) |
static | NormalizeUserName ($UserName) |
static | NormalizePassword ($Password) |
static | SetPasswordRules ($NewValue) |
Set password requirements. More... | |
static | SetPasswordMinLength ($NewValue) |
Set password minimum length. More... | |
static | SetPasswordMinUniqueChars ($NewValue) |
Set password minimum unique characters. More... | |
static | GetPasswordRulesDescription () |
Get a string describing the password rules. More... | |
Protected Attributes | |
$Resource = NULL | |
The user resource associated with the user or NULL if the user isn't logged in. More... | |
![]() | |
$DB | |
$UserId = NULL | |
$Result | |
$LoggedIn | |
$Status | |
Additional Inherited Members | |
![]() | |
const | PW_REQUIRE_PUNCTUATION = 1 |
const | PW_REQUIRE_MIXEDCASE = 2 |
const | PW_REQUIRE_DIGITS = 4 |
CWIS-specific user class.
Definition at line 13 of file CWUser.php.
CWUser::__construct | ( | $UserInfo = NULL | ) |
Load user data from the given user info or from the session if available.
mixed | $UserInfo | A user ID or user name. (OPTIONAL) |
Definition at line 22 of file CWUser.php.
References $Resource, User\IsAnonymous(), User\SetEmailFunction(), and U_OKAY.
CWUser::Delete | ( | ) |
Delete the user and its associated user resource.
Methods should not be called on the object after calling this method.
Definition at line 315 of file CWUser.php.
References Resource\Delete(), and U_OKAY.
|
static |
Adapter method to bridge between User class and Email class.
string | $To | To line for message. |
string | $Subject | Subject line for message. |
string | $Message | Body of message. |
string | $AdditionalHeaders | Other message header lines, concatenated together into a string. |
Definition at line 222 of file CWUser.php.
References User\$Result.
CWUser::Get | ( | $FieldName | ) |
Get a value from the specified field.
string | $FieldName | The name of the field to get. |
Definition at line 333 of file CWUser.php.
References Resource\Get(), and User\IsAnonymous().
|
static |
Get all custom user fields.
Definition at line 260 of file CWUser.php.
References MetadataSchema\SCHEMAID_USER.
|
static |
Get the default user fields.
Definition at line 286 of file CWUser.php.
References MetadataSchema\SCHEMAID_USER.
CWUser::GetResource | ( | ) |
Get the associated user resource for this user.
Definition at line 137 of file CWUser.php.
CWUser::GrantPriv | ( | $Privilege | ) |
Grant privilege to a a user.
int | $Privilege | Privilege to grant. |
Exception | On attempts to grant a pseudo-privilege. |
Definition at line 191 of file CWUser.php.
CWUser::HasPriv | ( | $Privilege, | |
$Privileges = NULL |
|||
) |
Determine if a user has a given privilege, or satisfies the conditions specified by a given privilege set.
Calling this function with a PrivilegeSet as the first argument is supported only for backwards compatibility. New code should not do this.
mixed | $Privilege | Privilige number or Privilige set to check |
mixed | $Privileges | Additional privileges (as in parent::HasPriv()), or a Resource to use if the first arg was a PrivilegeSet. |
Definition at line 154 of file CWUser.php.
References User\IsLoggedIn().
Referenced by PrivilegeSet\MeetsRequirements().
CWUser::Login | ( | $UserName, | |
$Password, | |||
$IgnorePassword = FALSE |
|||
) |
Log the specified user in and associate the underlying Resource with this CWUser.
string | $UserName | User to log in. |
string | $Password | User's password. |
bool | $IgnorePassword | TRUE to skip password validation (OPTIONAL, default FALSE) |
Definition at line 70 of file CWUser.php.
References $Resource, User\$Result, and U_OKAY.
CWUser::Logout | ( | ) |
Log this user out and disassociate their underlying Resource from this CWUser.
Definition at line 97 of file CWUser.php.
CWUser::Privileges | ( | PrivilegeSet | $NewValue = NULL | ) |
THIS FUNCTION HAS BEEN DEPRECATED This provides compatibility for interfaces written to use a version of PrivilegeSet from CWIS 3.0.0 to 3.1.0.
PrivilegeSet | $NewValue | New value (OPTIONAL, default NULL) |
Definition at line 110 of file CWUser.php.
CWUser::ResourceId | ( | ) |
Get the ID of the user resource associated with the user.
Definition at line 127 of file CWUser.php.
References Resource\Id().
CWUser::Set | ( | $Field, | |
$NewValue | |||
) |
Set a value for the specified field.
string | $Field | The field to set (name, id, or MetadataField object). |
mixed | $NewValue | The value to which to set the field. |
Definition at line 357 of file CWUser.php.
References User\$Result, User\IsAnonymous(), Resource\Set(), and U_OKAY.
CWUser::SetPrivList | ( | $NewPrivileges | ) |
Clear current user privs and replace them with the specified list.
array | $NewPrivileges | New privilege list to assign. Pseudo-privileges are filtered from the list passed to User::SetPrivList(). |
Definition at line 207 of file CWUser.php.
|
protected |
The user resource associated with the user or NULL if the user isn't logged in.
Definition at line 400 of file CWUser.php.
Referenced by __construct(), and Login().