Loads users.

As these classes may need setting of values this subclass implements the checkRegistryRequestsAnswers() easy access to resources.

package Gems
subpackage User
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.4.4
inherited_from \Gems_Loader_TargetLoaderAbstract

 Methods

__construct()

__construct(mixed $container, array $dirs) 
Inherited

Parameters

$container

mixed

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__get()

__get($name) 
Inherited

Parameters

$name

Add prefixed paths to the registry of paths

addPrefixPath(string $prefix, $path, boolean $prepend = true) : \Gems_Loader_LoaderAbstract
Inherited

Parameters

$prefix

string

$path

$prepend

boolean

Put path at the beginning of the stack (has no effect when prefix / dir already set)

Returns

\Gems_Loader_LoaderAbstract(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

Allows the loader to set resources.

answerRegistryRequest(string $name, mixed $resource) : boolean
Inherited

Parameters

$name

string

Name of resource to set

$resource

mixed

The resource.

Returns

booleanTrue if $resource was OK

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean
inherited_from \Gems_Loader_TargetLoaderAbstract::checkRegistryRequestsAnswers()

Returns

booleanFalse if required values are missing.

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean
Inherited

Returns

booleanFalse if required values are missing.

Returns a user object, that may be empty if no user exist.

createUser(string $login_name, integer $organization, string $userClassName, integer $userId) : \Gems_User_User

Parameters

$login_name

string

$organization

integer

$userClassName

string

$userId

integer

The person creating the user.

Returns

\Gems_User_UserNewly created

Makes sure default values are set for a user

ensureDefaultUserValues(array $values, \Gems_User_UserDefinitionInterface $definition, string $defName = null) : array

Parameters

$values

array

$definition

\Gems_User_UserDefinitionInterface

$defName

string

Optional

Returns

array

Get userclass / description array of available UserDefinitions for respondents

getAvailableRespondentDefinitions() : array

Returns

array

Get userclass / description array of available UserDefinitions for staff

getAvailableStaffDefinitions() : array

Returns

array

Returns a change password form for this user

getChangePasswordForm(\Gems_user_User $user, mixed $args_array = null) : \Gems_User_Form_ChangePasswordForm

Parameters

$user

\Gems_user_User

$args_array

mixed

\MUtil_Ra::args array for LoginForm initiation.

Returns

\Gems_User_Form_ChangePasswordForm

Get the currently loggin in user

getCurrentUser() : \Gems_User_User

Returns

\Gems_User_User

Returns a layered login form where user first selects a top organization and then a child organization

getLayeredLoginForm(mixed $args_array = null) : \Gems_User_Form_LayeredLoginForm

Parameters

$args_array

mixed

\MUtil_Ra::args array for LoginForm initiation.

Returns

\Gems_User_Form_LayeredLoginForm

Returns a login form

getLoginForm(mixed $args_array = null) : \Gems_User_Form_LoginForm

Parameters

$args_array

mixed

\MUtil_Ra::args array for LoginForm initiation.

Returns

\Gems_User_Form_LoginForm

Returns an organization object, initiated from the database or from self::$_noOrganization when the database does not yet exist.

getOrganization(integer $organizationId = null) : \Gems_User_Organization

Parameters

$organizationId

integer

Optional, uses current user or url when empty

Returns

\Gems_User_Organization

Returns the current organization according to the current site url.

getOrganizationIdByUrl() : integer
Static
static array $url An array of url => orgId values

Returns

integerAn organization id or null

Get password weakness checker.

getPasswordChecker() : \Gems_User_PasswordChecker

Returns

\Gems_User_PasswordChecker

Allows the loader to know the resources to set.

getRegistryRequests() : array
Inherited

Returns those object variables defined by the subclass but not at the level of this definition.

Can be overruled.

Returns

arrayof string names

Returns a reset form for handling both the incoming request and the outgoing reset request

getResetRequestForm(mixed $args_array = null) : \Gems_User_Form_ResetRequestForm

Parameters

$args_array

mixed

\MUtil_Ra::args array for LoginForm initiation.

Returns

\Gems_User_Form_ResetRequestForm

Returns a user object, that may be empty if no user exist.

getUser(string $login_name, integer $currentOrganization) : \Gems_User_User

Parameters

$login_name

string

$currentOrganization

integer

Returns

\Gems_User_UserBut ! ->isActive when the user does not exist

Get the user having the reset key specified

getUserByResetKey(string $resetKey) : \Gems_User_User

Parameters

$resetKey

string

Returns

\Gems_User_UserBut ! ->isActive when the user does not exist

Get a staff user using the $staff_id

getUserByStaffId(integer $staff_id) : \Gems_User_User

Parameters

$staff_id

integer

Returns

\Gems_User_UserBut ! ->isActive when the user does not exist

Retrieve a userdefinition, so we can check it's capabilities without instantiating a user.

getUserDefinition(string $userClassName) : \Gems_User_UserDefinitionInterface

Parameters

$userClassName

string

Returns

\Gems_User_UserDefinitionInterface

Check for password weakness.

reportPasswordWeakness(\Gems_User_User $user, string $password = null) : mixed

Parameters

$user

\Gems_User_User

The user for e.g. name checks

$password

string

Or null when you want a report on all the rules for this password.

Returns

mixedString or array of strings containing warning messages

Sets a new user as the current user.

setCurrentUser(\Gems_User_User $user) : \Gems_User_UserLoader

Parameters

$user

\Gems_User_User

Returns

\Gems_User_UserLoader(continuation pattern)

Removes the current user

unsetCurrentUser() : \Gems_User_UserLoader

Returns

\Gems_User_UserLoader(continuation pattern)

Add a subdirectory / sub name to a list of class load paths

_cascadedDirs(array $dirs, string $cascade, boolean $fullClassnameFallback = true) : array
Inherited

Parameters

$dirs

array

prefix => path

$cascade

string

The sub directories to cascade to

$fullClassnameFallback

boolean

Allows full class name specification instead of just plugin name part

Returns

arrayprefix => path

Returns $this->$name, creating the item if it does not yet exist.

_getClass(string $name, string $className = null, array $arguments = array()) : mixed
Inherited

Parameters

$name

string

The $name of the variable to store this object in.

$className

string

Class name or null if the same as $name, prepending $this->_dirs.

$arguments

array

Class initialization arguments.

Returns

mixedInstance of $className

Create or loads the class. When only loading, this function returns a StaticCall object that can be invoked lazely.

_loadClass(string $name, boolean $create = false, array $arguments = array()) : mixed
Inherited
see
see

Parameters

$name

string

The class name, minus the part in $this->_dirs.

$create

boolean

Create the object, or only when an \MUtil_Registry_TargetInterface instance.

$arguments

array

Class initialization arguments.

Returns

mixedA class instance or a \MUtil_Lazy_StaticCall object

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

Returns the name of the user definition class of this user.

getUserClass(string $login_name, integer $organization) : \Gems_User_User

Parameters

$login_name

string

$organization

integer

Returns

\Gems_User_UserBut ! ->isActive when the user does not exist

Returns a select statement to find a corresponding user.

getUserClassSelect(string $login_name, integer $organization) : \Zend_Db_Select

Parameters

$login_name

string

$organization

integer

Returns

\Zend_Db_Select

Check: is this user the super user defined in project.ini?

isProjectUser(string $login_name) : boolean

Parameters

$login_name

string

Returns

boolean

Returns a loaded user object

loadUser(string $defName, integer $userOrganization, string $userName) : \Gems_User_User

Parameters

$defName

string

$userOrganization

integer

$userName

string

Returns

\Gems_User_UserBut ! ->isActive when the user does not exist

 Properties

 

When true a user is allowed to login to a different organization than the one that provides an account. See GetUserClassSelect for the possible options but be aware that duplicate accounts could lead to problems. To avoid problems you can always use the organization switch AFTER login.

$allowLoginOnOtherOrganization : boolean

Default

false
 

When true a user is allowed to login without specifying an organization See GetUserClassSelect for the possible options but be aware that duplicate accounts could lead to problems. To avoid problems you can always use the organization switch AFTER login.

$allowLoginOnWithoutOrganization : boolean

Default

false
 

When true Respondent members can use their e-mail address as login name

$allowRespondentEmailLogin : boolean

Default

false
 

When true Staff members can use their e-mail address as login name

$allowStaffEmailLogin : boolean

Default

false
 

The prefix/path location to look for classes.

$_dirs : array

Default

The standard value is

  • => application/classes
  • Gems => library/Gems/classes

But an alternative could be:

  • Demopulse => application/classes
  • Pulse => application/classes
  • Gems => library/Gems/classes
 

$_loader

$_loader : \MUtil_Loader_PluginLoader

Default

 

$cache

$cache : \Zend_Cache_Core

Default

 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

'User'
 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

null
 

There can be only one, current user that is.

$currentUser : \Gems_User_User

Default

Static
 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$project

$project : \Gems_Project_ProjectSettings

Default

 

$session

$session : \Zend_Session_Namespace

Default

 

$translate

$translate : \Zend_Translate_Adapter

Default

 

$util

$util : \Gems_Util

Default

 Constants

 

The org ID for no organization

SYSTEM_NO_ORG = -1 
 

The user id used for the project user

SYSTEM_USER_ID = 1 
 

User class constants

USER_CONSOLE = 'ConsoleUser' 
 

USER_NOLOGIN

USER_NOLOGIN = 'NoLogin' 
 

USER_OLD_STAFF

USER_OLD_STAFF = 'OldStaffUser' 
 

USER_PROJECT

USER_PROJECT = 'ProjectUser' 
 

USER_RESPONDENT

USER_RESPONDENT = 'RespondentUser' 
 

USER_STAFF

USER_STAFF = 'StaffUser'