CWIS Developer Documentation

- Home
- Main Page
- 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
| 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)

## 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

## 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 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 224 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 131 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 315 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 242 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 169 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 195 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 84 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

  $Privilege | Privilige number or Privilige set to check
  $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 102 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 363 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 413 of file CWUser.php.

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

Definition at line 412 of file CWUser.php.

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

Definition at line 408 of file CWUser.php.

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

Definition at line 419 of file CWUser.php.

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

Definition at line 418 of file CWUser.php.

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

Definition at line 409 of file CWUser.php.

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

Definition at line 410 of file CWUser.php.

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

Definition at line 411 of file CWUser.php.

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

Definition at line 407 of file CWUser.php.

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

Definition at line 405 of file CWUser.php.

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

Definition at line 406 of file CWUser.php.

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

Definition at line 415 of file CWUser.php.

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

Definition at line 417 of file CWUser.php.

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

Definition at line 416 of file CWUser.php.

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

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

Definition at line 57 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 74 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 268 of file CWUser.php.

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

## Member Data Documentation

CWUser::$MigratedUserFields
| static protected

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

Referenced by __construct().

const CWUser::UIPREF_AUDIODESCRIPTION_EXPANDED = 2

Definition at line 397 of file CWUser.php.

const CWUser::UIPREF_AUDIODESCRIPTION_NONE = 0

Definition at line 395 of file CWUser.php.

const CWUser::UIPREF_AUDIODESCRIPTION_STANDARD = 1

Definition at line 396 of file CWUser.php.

const CWUser::UIPREF_AVOID_BLUEYELLOW = 4

Definition at line 377 of file CWUser.php.

const CWUser::UIPREF_AVOID_GREENYELLOW = 8

Definition at line 378 of file CWUser.php.

const CWUser::UIPREF_AVOID_ORANGE = 16

Definition at line 379 of file CWUser.php.

const CWUser::UIPREF_AVOID_PURPLEGREY = 64

Definition at line 381 of file CWUser.php.

const CWUser::UIPREF_AVOID_RED = 1

Definition at line 375 of file CWUser.php.

const CWUser::UIPREF_AVOID_REDBLACK = 32

Definition at line 380 of file CWUser.php.

const CWUser::UIPREF_AVOID_REDGREEN = 2

Definition at line 376 of file CWUser.php.

const CWUser::UIPREF_AVOID_USEMAXMONOCHR = 128

Definition at line 382 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_NONE = 0

Definition at line 400 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_REDUCEDREADINGLEVEL = 2

Definition at line 402 of file CWUser.php.

const CWUser::UIPREF_CAPTIONTYPE_VERBATIM = 1

Definition at line 401 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_DETAILED = 1

Definition at line 386 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_NOPREFERENCE = 0

Definition at line 385 of file CWUser.php.

const CWUser::UIPREF_CONTENTDENSITY_OVERVIEW = 2

Definition at line 387 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_IMAGEINTENSIVE = 2

Definition at line 392 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_NOPREFERENCE = 0

Definition at line 390 of file CWUser.php.

const CWUser::UIPREF_CONTENTVIEW_TEXTINTENSIVE = 1

Definition at line 391 of file CWUser.php.

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

- objects/CWUser.php