CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

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

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

CWIS-specific user factory class. More...

Inheritance diagram for CWUserFactory:
[legend]
Collaboration diagram for CWUserFactory:
[legend]

## Public Member Functions
| __construct ()
| Construct the user factory object. More...
| GetTopContributors ($Limit=5)
| Get a list of users sorted by how many resources they have added or edited, starting with those who have added/edited the most. More...
| GetMostRecentContributors ($Limit=5)
| Get the users sorted by when they last added or edited a resource starting with those who added/edited a resource most recently. More...
| FindUsersThatMeetRequirements ($Privset, $ResourceIds=array())
| Find all users that meet the requirements for a specified privilege set. More...
| CreateNewUser ($UserName, $Password, $PasswordAgain, $EMail, $EMailAgain, $IgnoreErrorCodes=NULL)
| Create a new user. More...
Public Member Functions inherited from UserFactory
| __construct ()
| Object constructor. More...
| CreateNewUser ($UserName, $Password, $PasswordAgain, $EMail, $EMailAgain, $IgnoreErrorCodes=NULL)
| Create new user. More...
| TestNewUserValues ($UserName, $Password, $PasswordAgain, $EMail, $EMailAgain)
| Test new user values (usually used before creating new user). More...
| GetUserCount ($Condition=NULL)
| Return number of users in the system. More...
| GetMatchingUserCount ()
| Get total number of user that matched last GetMatchingUsers() call. More...
| GetUserIds ()
| Get IDs for all users. More...
| GetLoggedInUsers ($InactivityTimeout=60)
| Get users who are currently logged in (i.e. More...
| GetRecentlyLoggedInUsers ($Since=NULL, $Limit=10)
| Get users recently logged in. More...
| GetUsersWithPrivileges ()
| Return array of user names who have the specified privileges. More...
| FindUsers ($SearchString, $FieldName="UserName", $SortFieldName="UserName", $Offset=0, $Count=9999999)
| Get users who have values matching specified string in specified field. More...
| FindUserNames ($SearchString, $FieldName="UserName", $SortFieldName="UserName", $Offset=0, $Count=9999999, $IdExclusions=array(), $ValueExclusions=array())
| Get users who have values matching specified string in specified field. More...
| GetMatchingUsers ($SearchString, $FieldName=NULL, $SortFieldName="UserName", $ResultsStartAt=0, $ReturnNumber=NULL)
| Return array of users who have values matching search string (in specific field if requested). More...
| UserExists ($UserId)
| Check whether user currently exists with specified ID. More...
| UserNameExists ($UserName)
| Check whether user name currently exists. More...
| EMailAddressIsInUse ($Address)
| Check whether e-mail address currently has account associated with it. More...
| GetNewestUsers ($Limit=5)
| Get the users sorted by when they signed up, starting with those who signed up most recently. More...

## Static Public Member Functions
static | GenerateUniqueUsernameFromEmail ($Email)
| Derive a unique username from an email address. More...
static | FilterNonViewableResourcesFromPerUserLists ($ResourcesPerUser)
| Take a per-user list of resources and filter out the non-viewable ones. More...

## Protected Attributes
| $ResourceFactory
| The resource factory for user resources. More...
Protected Attributes inherited from UserFactory
| $DB
| $SortFieldName
| $MatchingUserCount

## Detailed Description

CWIS-specific user factory class.

Definition at line 13 of file CWUserFactory.php.

## Constructor & Destructor Documentation

CWUserFactory::__construct | ( |  | ) |

Construct the user factory object.

Definition at line 20 of file CWUserFactory.php.

References MetadataSchema\SCHEMAID_USER.

## Member Function Documentation

CWUserFactory::CreateNewUser | ( |  | $UserName,
|  |  | $Password,
|  |  | $PasswordAgain,
|  |  | $EMail,
|  |  | $EMailAgain,
|  |  | $IgnoreErrorCodes = `NULL`
| ) |  |

Create a new user.

The second password and e-mail address parameters are intended for second copies of each entered by the user.

Parameters

  string | $UserName | Login name for new user.
  string | $Password | Password for new user.
  string | $PasswordAgain | Second copy of password entered by user.
  string | $EMail | E-mail address for new user.
  string | $EMailAgain | Second copy of e-mail address entered by user.
  bool | $IgnoreErrorCodes | Array containing any error codes that should be ignored. (OPTIONAL)

Returns
  CWUser object or array of error codes.

Definition at line 273 of file CWUserFactory.php.

References Resource\Create(), MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\SCHEMAID_USER, U_OKAY, and MetadataField\UPDATEMETHOD_ONRECORDCREATE.

static CWUserFactory::FilterNonViewableResourcesFromPerUserLists | ( |  | $ResourcesPerUser | ) |
| static

Take a per-user list of resources and filter out the non-viewable ones.

Parameters

  array | $ResourcesPerUser | Array keyed by UserId giving a list of ResourceIds.

Returns
  Array keyed by UserId giving the resources visible to each user in the input.

Definition at line 220 of file CWUserFactory.php.

References ResourceFactory\BuildMultiSchemaResourceList(), and ResourceFactory\FlattenMultiSchemaResourceList().

CWUserFactory::FindUsersThatMeetRequirements | ( |  | $Privset,
|  |  | $ResourceIds = `array()`
| ) |  |

Find all users that meet the requirements for a specified privilege set.

This is (currently) a very brute-force, inefficient implementation, so it should not be used anywhere long execution times might be an issue.

Parameters

  PrivilegeSet | $Privset | Privilege Set giving the requirements to satisfy.
  array | $ResourceIds | IDs of resources to use for comparisons, if the set includes resource-dependent conditions. (OPTIONAL)

Returns
  array Array with IDs of users that meet requirements for the index, and which resource IDs match for that user for the values.

Definition at line 107 of file CWUserFactory.php.

References UserFactory\GetUserIds(), and UserFactory\GetUsersWithPrivileges().

static CWUserFactory::GenerateUniqueUsernameFromEmail | ( |  | $Email | ) |
| static

Derive a unique username from an email address.

Parameters

  string | $Email | Source email address.

Returns
  string Unique username.

Definition at line 186 of file CWUserFactory.php.

CWUserFactory::GetMostRecentContributors | ( |  | $Limit = `5` | ) |

Get the users sorted by when they last added or edited a resource starting with those who added/edited a resource most recently.

Parameters

  int | $Limit | The maximum number of users to return. (OPTIONAL, defaults to 5.)

Returns
  array List of users, with user IDs for the index and CWUser objects for the values.

Definition at line 69 of file CWUserFactory.php.

CWUserFactory::GetTopContributors | ( |  | $Limit = `5` | ) |

Get a list of users sorted by how many resources they have added or edited, starting with those who have added/edited the most.

Parameters

  int | $Limit | The maximum number of users to return. (OPTIONAL, defaults to 5.)

Returns
  array List of users, with user IDs for the index and CWUser objects for the values.

Definition at line 34 of file CWUserFactory.php.

## Member Data Documentation

CWUserFactory::$ResourceFactory
| protected

The resource factory for user resources.

Definition at line 362 of file CWUserFactory.php.

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

- objects/CWUserFactory.php