CWIS Developer Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CWUser Class Reference

CWIS-specific user class. More...

Inheritance diagram for CWUser:
Inheritance graph
[legend]
Collaboration diagram for CWUser:
Collaboration graph
[legend]

Public Member Functions

 __construct ($UserInfo=NULL)
 Load user data from the given user info or from the session if available. More...
 
 Privileges (PrivilegeSet $NewValue=NULL)
 Get/set user privileges as a set. 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)
 
 Delete ()
 Delete the user and its associated user resource. More...
 
 Get ($FieldName)
 Get a value from the specified field. More...
 
 Set ($FieldName, $NewValue)
 Set a value for the specified field. More...
 
- Public Member Functions inherited from User
 User ($UserInfoOne=NULL, $UserInfoTwo=NULL)
 
 Status ()
 
 StatusMessage ($StatusCode=NULL)
 
 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 ()
 
 IsNotLoggedIn ()
 
 ChangePassword ($OldPassword, $NewPassword, $NewPasswordAgain)
 
 SetPassword ($NewPassword)
 
 CreateNewUserWithEMailedPassword ($UserName, $EMail, $EMailAgain, $TemplateFile="Axis--User--EMailTemplate.txt")
 
 CreateNewUserAndMailPasswordFromFile ($UserName, $EMail, $EMailAgain, $TemplateFile="Axis--User--EMailTemplate.txt")
 
 CreateNewUserAndMailPassword ($UserName, $EMail, $EMailAgain, $EMailSubject, $EMailBody)
 
 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 AxisPHP User class and ScoutLib Email class. More...
 
static GetCustomUserFields ()
 Get all custom user fields. More...
 
static GetDefaultUserFields ()
 Get the default user fields. More...
 
- Static Public Member Functions inherited from User
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 IsValidUserName ($UserName)
 
static IsValidPassword ($Password)
 
static IsValidLookingEMailAddress ($EMail)
 
static NormalizeEMailAddress ($EMailAddress)
 
static NormalizeUserName ($UserName)
 
static NormalizePassword ($Password)
 

Protected Member Functions

 FetchAssociatedResource ($UserId)
 Fetch the associated user resource based off of a user ID. More...
 
 IsResourceObjectSet ()
 Determine if the resource object for this object is set. More...
 

Protected Attributes

 $Resource
 The user resource associated with the user or NULL if the user isn't logged in. More...
 
- Protected Attributes inherited from User
 $DB
 
 $UserId = NULL
 
 $Result
 
 $LoggedIn
 

Static Protected Attributes

static $MigratedUserFields
 Fields that were previously part of the APUsers table that have been migrated to the Resources table as of CWIS 3.0.0. More...
 

Detailed Description

CWIS-specific user class.

Definition at line 13 of file CWUser.php.

Constructor & Destructor Documentation

CWUser::__construct (   $UserInfo = NULL)

Load user data from the given user info or from the session if available.

Parameters
mixed$UserInfoA user ID or user name. (OPTIONAL)

Definition at line 21 of file CWUser.php.

References $Resource, FetchAssociatedResource(), User\SetEmailFunction(), and U_OKAY.

Member Function Documentation

CWUser::Delete ( )

Delete the user and its associated user resource.

Methods should not be called on the object after calling this method.

Returns
Returns the status of the deletion attempt.

Definition at line 220 of file CWUser.php.

References Resource\Delete(), and U_OKAY.

static CWUser::EmailWrapper (   $To,
  $Subject,
  $Message,
  $AdditionalHeaders 
)
static

Adapter method to bridge between AxisPHP User class and ScoutLib Email class.

Parameters
string$ToTo line for message.
string$SubjectSubject line for message.
string$MessageBody of message.
string$AdditionalHeadersOther message header lines, concatenated together into a string.
Returns
bool TRUE if message successfully accepted for delivery, otherwise FALSE.

Definition at line 127 of file CWUser.php.

References User\$Result.

CWUser::FetchAssociatedResource (   $UserId)
protected

Fetch the associated user resource based off of a user ID.

Parameters
int$UserIdThe user ID for the user associated with the esource.
Returns
Returns the associated user resource or an error status if an error occurs.

Definition at line 311 of file CWUser.php.

References User\$UserId, MetadataSchema\SCHEMAID_USER, U_ERROR, and U_NOSUCHUSER.

Referenced by __construct().

Here is the caller graph for this function:

CWUser::Get (   $FieldName)

Get a value from the specified field.

Parameters
string$FieldNameThe name of the field to get.
Returns
Returns the field value or NULL if user data isn't available, e.g., the user isn't logged in.

Definition at line 238 of file CWUser.php.

References Resource\Get(), and IsResourceObjectSet().

static CWUser::GetCustomUserFields ( )
static

Get all custom user fields.

Returns
Returns an array of the custom user fields.

Definition at line 165 of file CWUser.php.

References MetadataSchema\SCHEMAID_USER.

static CWUser::GetDefaultUserFields ( )
static

Get the default user fields.

Returns
Returns an array of the default user fields.

Definition at line 191 of file CWUser.php.

References MetadataSchema\SCHEMAID_USER.

CWUser::GetResource ( )

Get the associated user resource for this user.

Returns
Returns the associated user resource or NULL if it's not available, e.g., the user isn't logged in.

Definition at line 98 of file CWUser.php.

References IsResourceObjectSet().

CWUser::HasPriv (   $Privilege,
  $Privileges = NULL 
)

Definition at line 104 of file CWUser.php.

References Privileges().

CWUser::IsResourceObjectSet ( )
protected

Determine if the resource object for this object is set.

Returns
Returns TRUE if the resource object for this objects is set.

Definition at line 359 of file CWUser.php.

Referenced by Get(), GetResource(), ResourceId(), and Set().

Here is the caller graph for this function:

CWUser::Privileges ( PrivilegeSet  $NewValue = NULL)

Get/set user privileges as a set.

Parameters
PrivilegeSet$NewValueNew set of privileges. (OPTIONAL)
Returns
PrivilegeSet Current set of privileges.

Definition at line 57 of file CWUser.php.

References User\GetPrivList(), User\Id(), and User\SetPrivList().

Referenced by HasPriv().

Here is the caller graph for this function:

CWUser::ResourceId ( )

Get the ID of the user resource associated with the user.

Returns
Returns the ID of the associated user resource or NULL if it's not available, e.g., the user isn't logged in.

Definition at line 88 of file CWUser.php.

References Resource\Id(), and IsResourceObjectSet().

CWUser::Set (   $FieldName,
  $NewValue 
)

Set a value for the specified field.

Parameters
string$FieldNameThe name of the field to set.
mixed$NewValueThe value to which to set the field.
Returns
Returns the status of the operation.

Definition at line 264 of file CWUser.php.

References IsResourceObjectSet(), Resource\Set(), and U_OKAY.

Member Data Documentation

CWUser::$MigratedUserFields
staticprotected
Initial value:
= array(
"RealName", "WebSite", "AddressLineOne", "AddressLineTwo", "City",
"State", "ZipCode", "Country")

Fields that were previously part of the APUsers table that have been migrated to the Resources table as of CWIS 3.0.0.

Definition at line 301 of file CWUser.php.

CWUser::$Resource
protected

The user resource associated with the user or NULL if the user isn't logged in.

Definition at line 295 of file CWUser.php.

Referenced by __construct().


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