CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

CWIS-specific user class. More...

Inheritance diagram for CWUser:
[legend]
Collaboration diagram for CWUser:
[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)
| 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...
| 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...
| PrefFontSize ($NewValue=DB_NOVALUE)
| PrefFontTypeFace ($NewValue=DB_NOVALUE)
| PrefFontColor ($NewValue=DB_NOVALUE)
| PrefBackgroundColor ($NewValue=DB_NOVALUE)
| PrefColorAvoidanceFlags ($NewValue=DB_NOVALUE)
| PrefContentDensity ($NewValue=DB_NOVALUE)
| PrefContentView ($NewValue=DB_NOVALUE)
| PrefAudioDescriptionLevel ($NewValue=DB_NOVALUE)
| PrefAudioDescriptionLanguage ($NewValue=DB_NOVALUE)
| PrefVisualDescriptionLanguage ($NewValue=DB_NOVALUE)
| PrefImageDescriptionLanguage ($NewValue=DB_NOVALUE)
| PrefUseGraphicAlternatives ($NewValue=DB_NOVALUE)
| PrefSignLanguage ($NewValue=DB_NOVALUE)
| PrefCaptionType ($NewValue=DB_NOVALUE)
| PrefCaptionRate ($NewValue=DB_NOVALUE)
Public Member Functions inherited from User
| __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)
| 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 | 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...

## Public Attributes
const | UIPREF_AVOID_RED = 1
const | UIPREF_AVOID_REDGREEN = 2
const | UIPREF_AVOID_BLUEYELLOW = 4
const | UIPREF_AVOID_GREENYELLOW = 8
const | UIPREF_AVOID_ORANGE = 16
const | UIPREF_AVOID_REDBLACK = 32
const | UIPREF_AVOID_PURPLEGREY = 64
const | UIPREF_AVOID_USEMAXMONOCHR = 128
const | UIPREF_CONTENTDENSITY_NOPREFERENCE = 0
const | UIPREF_CONTENTDENSITY_DETAILED = 1
const | UIPREF_CONTENTDENSITY_OVERVIEW = 2
const | UIPREF_CONTENTVIEW_NOPREFERENCE = 0
const | UIPREF_CONTENTVIEW_TEXTINTENSIVE = 1
const | UIPREF_CONTENTVIEW_IMAGEINTENSIVE = 2
const | UIPREF_AUDIODESCRIPTION_NONE = 0
const | UIPREF_AUDIODESCRIPTION_STANDARD = 1
const | UIPREF_AUDIODESCRIPTION_EXPANDED = 2
const | UIPREF_CAPTIONTYPE_NONE = 0
const | UIPREF_CAPTIONTYPE_VERBATIM = 1
const | UIPREF_CAPTIONTYPE_REDUCEDREADINGLEVEL = 2
Public Attributes inherited from User
const | PW_REQUIRE_PUNCTUATION = 1
const | PW_REQUIRE_MIXEDCASE = 2
const | PW_REQUIRE_DIGITS = 4

## 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 | $UserInfo | A user ID or user name. (OPTIONAL)

Definition at line 22 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 226 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 | $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.

Returns
  bool TRUE if message successfully accepted for delivery, otherwise FALSE.

Definition at line 133 of file CWUser.php.

References User\$Result.

CWUser::FetchAssociatedResource | ( |  | $UserId | ) |
| protected

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

Parameters

  int | $UserId | The 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 317 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 | $FieldName | The 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 244 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 171 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 197 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 86 of file CWUser.php.

References IsResourceObjectSet().

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.

Parameters

  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.

Returns
  TRUE if the user has the specified privilege (or satisfies the requirements of the specified privilege set.

Definition at line 104 of file CWUser.php.

Referenced by PrivilegeSet\MeetsRequirements().

Here is the caller graph for this function:

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 373 of file CWUser.php.

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

Here is the caller graph for this function:

CWUser::PrefAudioDescriptionLanguage | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 441 of file CWUser.php.

CWUser::PrefAudioDescriptionLevel | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 438 of file CWUser.php.

CWUser::PrefBackgroundColor | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 426 of file CWUser.php.

CWUser::PrefCaptionRate | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 459 of file CWUser.php.

CWUser::PrefCaptionType | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 456 of file CWUser.php.

CWUser::PrefColorAvoidanceFlags | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 429 of file CWUser.php.

CWUser::PrefContentDensity | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 432 of file CWUser.php.

CWUser::PrefContentView | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 435 of file CWUser.php.

CWUser::PrefFontColor | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 423 of file CWUser.php.

CWUser::PrefFontSize | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 417 of file CWUser.php.

CWUser::PrefFontTypeFace | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 420 of file CWUser.php.

CWUser::PrefImageDescriptionLanguage | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 447 of file CWUser.php.

CWUser::PrefSignLanguage | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 453 of file CWUser.php.

CWUser::PrefUseGraphicAlternatives | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 450 of file CWUser.php.

CWUser::PrefVisualDescriptionLanguage | ( |  | $NewValue = `DB_NOVALUE` | ) |

Definition at line 444 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.

Parameters

  PrivilegeSet | $NewValue | New value (OPTIONAL, default NULL)

Returns
  PrivilegeSetCompatibiliityShim for use in legacy code.

Definition at line 59 of file CWUser.php.

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 76 of file CWUser.php.

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

CWUser::Set | ( |  | $FieldName,
|  |  | $NewValue
| ) |  |

Set a value for the specified field.

Parameters

  string | $FieldName | The name of the field to set.
  mixed | $NewValue | The value to which to set the field.

Returns
  Returns the status of the operation.

Definition at line 270 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 307 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 301 of file CWUser.php.

Referenced by __construct().

const CWUser::UIPREF_AUDIODESCRIPTION_EXPANDED = 2

Definition at line 407 of file CWUser.php.

const CWUser::UIPREF_AUDIODESCRIPTION_NONE = 0

Definition at line 405 of file CWUser.php.

const CWUser::UIPREF_AUDIODESCRIPTION_STANDARD = 1

Definition at line 406 of file CWUser.php.

const CWUser::UIPREF_AVOID_BLUEYELLOW = 4

Definition at line 387 of file CWUser.php.

const CWUser::UIPREF_AVOID_GREENYELLOW = 8

Definition at line 388 of file CWUser.php.

const CWUser::UIPREF_AVOID_ORANGE = 16

Definition at line 389 of file CWUser.php.

const CWUser::UIPREF_AVOID_PURPLEGREY = 64

Definition at line 391 of file CWUser.php.

const CWUser::UIPREF_AVOID_RED = 1

Definition at line 385 of file CWUser.php.

const CWUser::UIPREF_AVOID_REDBLACK = 32

Definition at line 390 of file CWUser.php.

const CWUser::UIPREF_AVOID_REDGREEN = 2

Definition at line 386 of file CWUser.php.

const CWUser::UIPREF_AVOID_USEMAXMONOCHR = 128

Definition at line 392 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_NONE = 0

Definition at line 410 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_REDUCEDREADINGLEVEL = 2

Definition at line 412 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_VERBATIM = 1

Definition at line 411 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_DETAILED = 1

Definition at line 396 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_NOPREFERENCE = 0

Definition at line 395 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_OVERVIEW = 2

Definition at line 397 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_IMAGEINTENSIVE = 2

Definition at line 402 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_NOPREFERENCE = 0

Definition at line 400 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_TEXTINTENSIVE = 1

Definition at line 401 of file CWUser.php.

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

- objects/CWUser.php