public static
boolean
|
#
canModifyEmailAddress( hrm\user\UserV2 $user )
Return true if the UserManager can modify a User's e-mail address
in the backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Return true if the UserManager can modify a User's e-mail address
in the backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Parameters
- $user
- User to be queried.
Returns
boolean True if the UserManager can modify tue User's e-mail
address in the backing user management system, false otherwise.
|
public static
boolean
|
#
canModifyGroup( hrm\user\UserV2 $user )
Return true if the UserManager can modify a User's group in the
backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Return true if the UserManager can modify a User's group in the
backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Parameters
- $user
- User to be queried.
Returns
boolean True if the UserManager can modify tue User's group
address in the backing user management system, false otherwise.
|
public static
boolean
|
#
canModifyPassword( hrm\user\UserV2 $user )
Return true if the UserManager can modify a User's password in the
backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Return true if the UserManager can modify a User's password in the
backing user management system (e.g. Integrated, Active Directory,
LDAP, or Auth0).
Parameters
- $user
- User to be queried.
Returns
boolean True if the UserManager can modify tue User's password
in the backing user management system, false otherwise.
|
public static
boolean
|
#
existsUser( hrm\user\UserV2 $user )
Check whether the user exists in the User table already.
Check whether the user exists in the User table already.
Parameters
- $user
- User for which to check for existence.
Returns
boolean True if the user exists; false otherwise.
|
public static
boolean
|
#
existsUserWithName( string $username )
Check whether the user with given name exists in the User table already.
Check whether the user with given name exists in the User table already.
Parameters
- $username
- Name of the User.
Returns
boolean True if the user exists; false otherwise.
|
public static
UserV2/null
|
#
findUserByName( string $username )
Find and return a User by name.
Find and return a User by name.
Parameters
- $username
- Name of the User to be retrieved.
Returns
UserV2/null Requested User or null if not found.
|
public static
string
|
#
generateRandomPlainPassword( )
Generates a random (plain) password.
Generates a random (plain) password.
The password returned should still be encrypted (by whatever means)
before it is stored into a database.
Returns
string Plain text password.
|
public static
string
|
#
generateUniqueId( )
Generates a random unique id.
Generates a random unique id.
Returns
string Id.
|
public static
boolean
|
#
isLoginRestrictedToAdmin( )
Checks if user login is restricted to the administrator for maintenance
(e.g. in case the database has to be updated).
Checks if user login is restricted to the administrator for maintenance
(e.g. in case the database has to be updated).
Returns
boolean True if the user login is restricted to the administrator.
|
public static
boolean
|
#
existsUserRegistrationRequestWithSeed( string $seed )
Checks whether a seed for a user creation request exists.
Checks whether a seed for a user creation request exists.
Notice, that the user must also have status != UserConstants::STATUS_PASSWORD_RESET
in the database.
Parameters
- $seed
- Seed to be compared.
Returns
boolean True if a user with given seed exists, false otherwise.
|
public static
boolean
|
#
existsUserPasswordResetRequestWithSeed( string $username, $seed )
Checks whether a seed for a password reset request exists.
Checks whether a seed for a password reset request exists.
Notice, that the user must also have status = UserConstants::STATUS_PASSWORD_RESET
in the database.
This function returns false by default and must be reimplemented for
those user management implementations that support this.
Parameters
- $username
- $seed Seed to be compared.
- $seed
Returns
boolean True if a user with given seed exists, false otherwise.
Username
string User name that is expected to have the specified seed.
|
public static
string
|
#
generateAndSetSeed( string $name )
Generate and set a random seed for User with given name. This also changes
the status of the user to UserConstants::STATUS_PASSWORD_RESET.
Generate and set a random seed for User with given name. This also changes
the status of the user to UserConstants::STATUS_PASSWORD_RESET.
Parameters
- $name
- Name of the user for which the seed is to be generated.
Returns
string Generated seed. If the seed could not be set, the function returns "".
|
public static
boolean
|
#
resetSeed( string $name )
Resets the seed for User with given name.
Resets the seed for User with given name.
Parameters
- $name
- Name of the user for which the seed is to be reset.
Returns
boolean True if the seed was reset, false otherwise.
|
public static
|
#
getAllInstitutions( )
Return all institution rows.
Return all institution rows.
|
public static
integer
|
#
numberOfJobsInQueue( string $username )
Returns the number of jobs currently in the queue for current User.
Returns the number of jobs currently in the queue for current User.
Parameters
- $username
- User name to query.
Returns
integer Number of jobs in queue.
|
public static
integer
|
#
getTotalNumberOfQueuedJobs( )
Returns the total number of jobs currently in the queue.
Returns the total number of jobs currently in the queue.
Returns
integer Total number of jobs in queue.
|
public static
|
#
addUser( hrm\user\UserV2 $user, $password = "" )
Adds a User to the database.
Adds a User to the database.
Parameters
- $user
- $password
User password The password is not stored in the User object.
Set $password to "" to create a random password (useful for external authentication
mechanisms).
|
public static
True
|
#
createUser( string $username, string $password, string $emailAddress, string $group, integer $institution_id = 1, string $authentication = "", integer $role = hrm\user\UserConstants::ROLE_USER , string $status = hrm\user\UserConstants::STATUS_ACTIVE , string $seed = "" )
Creates a new User.
Parameters
- $username
- User login name.
- $password
- User password in plain text. Set to "" to create a random one.
- $emailAddress
- User e-mail address.
- $group
- User group.
- $institution_id
- User institution id (default = 1).
- $authentication
User authentication mode (by default, it is the
default authentication mode: @see ProxyFactory::getDefaultAuthenticationMode()
- $role
- User role (optional, default is UserConstants::ROLE_USER).
- $status
User status (optional, the user is activated by
default).
- $seed
- Seed used to label a user registration request in the database.
Returns
True if the User could be created, false otherwise.
Throws
Exception If the authentication mode is not supported.
|
public static
boolean
|
#
storeUser( hrm\user\UserV2 $user, boolean $force = false )
Update or create the User after a successful login.
Update or create the User after a successful login.
If the User is not logged in, the method returns false immediately
unless the argument $force is set to True (default is False).
Otherwise, if the User exists, it is updated. If it does not exist,
it is created with a random password.
Parameters
- $user
- User to be updated in the database!
- $force
- User to be updated in the database!
Returns
boolean True if the User could be updated or created successfully,
false otherwise.
|
public static
hrm\user\UserV2
|
#
reload( hrm\user\UserV2 $user )
Force a reload from the database for given user.
Force a reload from the database for given user.
Parameters
- $user
User to update with the database content. The User must exist
in the database; if it does not, an Exception is thrown!
Returns
Throws
Exception If the user does not exist in the database.
|
public static
boolean
|
#
changeUserPassword( string $username, string $password )
Change the user password.
Change the user password.
Parameters
- $username
- User name.
- $password
- New password (plain text).
Returns
boolean True if the user password could be changed, false otherwise.
|
public static
boolean
|
#
deleteUser( string $username )
Deletes a user from the database.
Deletes a user from the database.
Parameters
- $username
- Name of the user to be deleted.
Returns
boolean True if success; false otherwise.
|
public static
boolean
|
#
setRole( string $username, integer $role = hrm\user\UserConstants::ROLE_USER )
Sets the user role in the database.
Sets the user role in the database.
Notice that the User itself is not changed, to update the User
after a database change, use:
$user->load();
Parameters
- $username
- Name of the user to modify.
- $role
Role, one of UserConstants::ROLE_* (default
UserConstants::ROLE_USER).
Returns
boolean True if the user role could be changed; false otherwise.
|
public static
boolean
|
#
setAuthenticationMode( string $username, string $mode )
Sets the authentication mode for the user with given name in the database.
Sets the authentication mode for the user with given name in the database.
Parameters
- $username
- Name of the user.
- $mode
One of the enabled authentication modes. Subset of
{'integrated', 'active_dir', 'ldap', 'auth0'}, depending on the
configuration.
Returns
boolean True if the authentication mode could be set successfully,
false otherwise.
|
public static
boolean
|
#
acceptUser( string $username )
Accepts user with given username.
Accepts user with given username.
Parameters
- $username
- Name of the user to accept.
Returns
boolean True if the user could be accepted; false otherwise.
|
public static
boolean
|
#
enableUser( string $username )
Enables user with given username.
Enables user with given username.
Parameters
- $username
- Name of the user to enable.
Returns
boolean True if the user could be enabled; false otherwise.
|
public static
boolean
|
#
enableAllUsers( )
Enables all users.
Returns
boolean True if all users could be enabled, false otherwise.
|
public static
boolean
|
#
disableUser( string $username )
Disables user with given username.
Disables user with given username.
Parameters
- $username
- Name of the user to disable.
Returns
boolean True if the user could be disabled; false otherwise.
|
public static
boolean
|
#
disableAllUsers( )
Disables all users.
Returns
boolean True if all users could be disabled; false otherwise.
|
public static
boolean
|
#
markUserForPasswordReset( string $username )
Accepts user with given username.
Accepts user with given username.
Parameters
- $username
- Name of the user to accept.
Returns
boolean True if the user could be accepted; false otherwise.
|
public static
array
|
#
getAllUserDBRows( )
Returns all user rows from the database (sorted by user name).
Returns all user rows from the database (sorted by user name).
Returns
array Array of user rows sorted by user name.
|
public static
array
|
#
getAllActiveUserDBRows( )
Returns all active user rows from the database (sorted by user name).
Returns all active user rows from the database (sorted by user name).
Returns
array Array of active user rows sorted by user name.
|
public static
array
|
#
getAllPendingUserDBRows( )
Returns all rows for users with pending requests from the database
(sorted by user name).
Returns all rows for users with pending requests from the database
(sorted by user name).
Returns
array Array of rows of users with pending requests sorted by
user name.
|
public static
array
|
#
getAllUserDBRowsByInitialLetter( string $c )
Returns all user rows from the database for user names starting by a
given letter (sorted by user name).
Returns all user rows from the database for user names starting by a
given letter (sorted by user name).
Parameters
Returns
array Array of user rows filtered by first letter and sorted by
user name.
|
public static
integer
|
#
getTotalNumberOfUsers( )
Returns the total number of users independent of their status (and
counting the administrator).
Returns the total number of users independent of their status (and
counting the administrator).
Returns
integer Number of users.
|
public static
array
|
#
getNumberCountPerInitialLetter( )
Returns a vector of counts of how many users have names starting with
each of the letters of the alphabet.
Returns a vector of counts of how many users have names starting with
each of the letters of the alphabet.
Returns
array Array of counts.
|
public static
|
#
createUserFolders( string $username )
Creates the user data folders.
Creates the user data folders.
Parameters
|
public static
|
#
deleteUserFolders( string $username )
Deletes the user data folders.
Deletes the user data folders.
Parameters
- $username
- User name for which to create the folders.
|
public static
string
|
#
getUserStatus( string $name )
Get the status of a User.
Get the status of a User.
By definition (not to prevent logging in against an external
authentication system), if a User does not exist, its status is active.
Parameters
Returns
string status ('a', 'd', ...).
|
public static
boolean
|
#
setUserStatus( string $name, string $status )
Set the status of a User.
Set the status of a User.
Parameters
- $name
- Name of the user.
- $status
- ('a', 'd', ...).
Returns
boolean True if the user status could be set successfully, false otherwise.
|