CSUser
extends CSItemApi
in package
The CSUser is an API to manage the users
Tags
Table of Contents
- CHECK_LOGIN_PERMISSION_ALL = 255
- Binary login permissions for the method "hasLoginPermissions"
- CHECK_LOGIN_PERMISSION_LOCKED = 1
- CHECK_LOGIN_PERMISSION_MAINTENANCE_MODE = 4
- CHECK_LOGIN_PERMISSION_TERMS_OF_USE = 2
- PASSWORD_RESET_CONTEXT_MODULE = -2
- PASSWORD_RESET_CONTEXT_PORTAL = -1
- PASSWORD_RESET_REASON_FORCED = 'USER_PASSWORD_RESET_REASON_FORCED'
- PASSWORD_RESET_REASON_REQUEST = 'USER_PASSWORD_RESET_REASON_REQUEST'
- $ENUM_SORTALGOS_FORMATTED : mixed
- $ENUM_SORTTYPES_DESC : mixed
- $lastUserID : mixed
- $tableApiClass : string
- $tableRowApiClass : string
- __construct() : mixed
- acceptTermsOfUse() : bool
- Marks as accepted the terms of use for a specific user
- authenticate() : User
- Authenticates the current session and returns the current user
- checkConcurrentUsers() : void
- Checks the maximal amount of concurrent users for a context.
- connect() : mixed
- Conntects to a CONTENTSERV project using the given username, password
- createField() : CSItemApiField
- Creates a new CSItemApiFields at the targeted position
- createGroup() : CSUserItem
- Creates a new user group at the targeted position
- createPasswordHash() : mixed
- createUser() : CSUserItem
- Creates a new User at the targeted position.
- generatePassword() : string
- Generates a new Password
- generateSalt() : mixed
- getApiFieldForExternalKey() : CSItemApiField
- Returns a specific field of an item or an empty Api Field when the key is null, empty or invalid
- getComparator() : CSItemComparator
- Creates a comparator object that can be used with the CSGuiItemComparatorTable
- getConcurrentAccessUserIDs() : array<string|int, mixed>
- Returns the UserIDs of all users who had accessed a component at a given time
- getConcurrentUserIDs() : array<string|int, mixed>
- Returns the UserIDs of all users who are logged in to the backend at the moment
- getCurrentUILanguageID() : int
- Returns the current UI languageID of the User.
- getField() : CSItemApiFields
- Loads an existing field for a given ID
- getFields() : mixed
- Returns an array with CSItemApiFields matching the SQL filter condition in the given sort order and limit
- getInstance() : mixed
- getMaintenanceUsers() : array<string|int, CSUserItem>
- Returns an array containing CSUserItems with ability to login when system has Maintenance Mode enabled.
- getPIN() : string
- Returns an integrated authentication Request GET Parameter of the form &CSPIN=Y3RzVXNlcj1hZG1pbmRlJm which will remain valid for seven days
- getSearchableApiFields() : mixed
- Returns an array with CSItemApiField matching the searchable condition in the given sort order and limit If $returnSimpleSearchables and $returnExtendedSearchables are set to false all fields are returned which are not searchable Otherwise the fields are returned matching at least one of the set criterias.
- getSSO() : string
- Returns an integrated authentication Request GET Parameter of the form &CSPIN=Y3RzVXNlcj1hZG1pbmRlJm which will remain valid for seven days
- getTicket() : string
- getUser() : CSUserItem
- Returns a user from the user base
- getUserByName() : CSUser
- Get the user with a given name
- getUserID() : int
- Returns the ID of the current user
- getUserIds() : array<string|int, mixed>
- Returns the userIDs according to filter provided.
- getUserIdsByAccessLevels() : mixed
- Creates a two dimensional array with the first key as alls accesslevel for each user in the form RoleID1@RubricID1|RoleID2@RubricID2|... and the value an array of UserIDs having this accesslevel
- getUserIdsByRoles() : array<string|int, mixed>
- returns an array containing all the RoleIDs as key and an array of UserIds as value
- getUserIdsForIdentities() : array<string|int, mixed>
- Returns all users with the given accesslevels and/or roles
- getUserIdsWithRights() : mixed
- returns an array containing all the UserIds having all the requested rights
- getUserName() : string
- Returns a UserName from the user base
- getUserRoles() : array<string|int, mixed>
- Returns a user's roles as objects.
- getUserRolesNames() : array<string|int, mixed>
- Returns a user's roles as display names.
- getUsers() : mixed
- Returns an array with CSUserItems matching the SQL filter condition in the given sort order and limit.
- getUserValue() : string
- Returns a user value from the user base
- getValueGetter() : CSItemValueGetter
- Returns a new CSItemValueGetter object
- getValueSetter() : CSItemValueSetter
- Returns a new CSItemValueSetter object
- getValuesGetter() : CSItemValuesGetter
- Returns a new CSItemValuesGetter object
- getValuesSetter() : CSItemValuesSetter
- Returns a new CSItemValuesSetter object
- hasAcceptedTermsOfUse() : bool
- Validates if a specific user has accepted the terms of use
- hasLoginPermissions() : bool
- Check if the user can login by verifying the permission passed as parameter
- isAnonymousUser() : bool
- Checks if the current user (or the one with the specified id) defines an anonymous user.
- isAuthenticated() : bool
- Returns whether the current user is authenticated or the 'Anonymous'
- limitAllowedHtmlTags() : mixed
- Limits all tags which are allowed in the formatted value result of any item This can e.g. be used for media neutral exports where not all html tags are supported
- logAccess() : void
- Logs the access of the user to a component in the Uservisit table. An access is only logged, if the last access is older than the PingTimeout in the Options or 300 seconds.
- logout() : mixed
- Ends the current session and sets the current user to 'Anonymous'
- may() : bool
- Returns a right from the user administration It is recommended to use the Records isAllowed([RIGHT]) method instead to ensure that all concepts like Accesslevels, fallbacks, ... are used.
- mayUse() : bool
- Returns the right to use a module
- resetTermsOfUse() : bool
- Resets the terms of use for all users. Necessary when the terms are updated
- sendNewPassword() : void
- Assigns a new password to a user or group and sends it by e-mail
- sendPasswordResetLink() : array<string|int, mixed>
- Sends an email with the password reset link for the given users
- switchToUser() : void
- Switches the current user to another user in this request.
Constants
CHECK_LOGIN_PERMISSION_ALL
Binary login permissions for the method "hasLoginPermissions"
public
mixed
CHECK_LOGIN_PERMISSION_ALL
= 255
Tags
CHECK_LOGIN_PERMISSION_LOCKED
public
mixed
CHECK_LOGIN_PERMISSION_LOCKED
= 1
Tags
CHECK_LOGIN_PERMISSION_MAINTENANCE_MODE
public
mixed
CHECK_LOGIN_PERMISSION_MAINTENANCE_MODE
= 4
Tags
CHECK_LOGIN_PERMISSION_TERMS_OF_USE
public
mixed
CHECK_LOGIN_PERMISSION_TERMS_OF_USE
= 2
Tags
PASSWORD_RESET_CONTEXT_MODULE
public
mixed
PASSWORD_RESET_CONTEXT_MODULE
= -2
Tags
PASSWORD_RESET_CONTEXT_PORTAL
public
mixed
PASSWORD_RESET_CONTEXT_PORTAL
= -1
Tags
PASSWORD_RESET_REASON_FORCED
public
mixed
PASSWORD_RESET_REASON_FORCED
= 'USER_PASSWORD_RESET_REASON_FORCED'
Tags
PASSWORD_RESET_REASON_REQUEST
public
mixed
PASSWORD_RESET_REASON_REQUEST
= 'USER_PASSWORD_RESET_REASON_REQUEST'
Tags
Properties
$ENUM_SORTALGOS_FORMATTED
public
static mixed
$ENUM_SORTALGOS_FORMATTED
= array(\CS_SORT_FORMATTED_ASC => 'GUI_EDIT_SORT_FORMATTED_ASC', \CS_SORT_FORMATTED_DESC => 'GUI_EDIT_SORT_FORMATTED_DESC')
Tags
$ENUM_SORTTYPES_DESC
public
static mixed
$ENUM_SORTTYPES_DESC
= array(\CS_SORT_NUMERICAL_DESC => 'GUI_EDIT_SORT_NUMERICAL_DESC', \CS_SORT_CASE_STRING_DESC => 'GUI_EDIT_SORT_CASE_STRING_DES', \CS_SORT_FORMATTED_DESC => 'GUI_EDIT_SORT_FORMATTED_DESC', \CS_SORT_STRING_DESC => 'GUI_EDIT_SORT_STRING_DESC', \CS_SORT_DATE_DESC => 'GUI_EDIT_SORT_DATE_DESC', \CS_SORT_DEFAULT_DESC => 'GUI_EDIT_SORT_DEFAULT_DESC')
Tags
$lastUserID
public
static mixed
$lastUserID
= 0
Tags
$tableApiClass
public
string
$tableApiClass
Tags
$tableRowApiClass
public
string
$tableRowApiClass
Tags
Methods
__construct()
public
__construct([mixed $itemClass = null ]) : mixed
Parameters
- $itemClass : mixed = null
Tags
Return values
mixed —acceptTermsOfUse()
Marks as accepted the terms of use for a specific user
public
static acceptTermsOfUse(int $iUserId) : bool
Parameters
- $iUserId : int
-
Id of the user to accept the terms to
Tags
Return values
bool —whether the storing of the user acceptance was successful
authenticate()
Authenticates the current session and returns the current user
public
static authenticate([mixed $requireRightToLogin = true ][, string $user = '' ][, mixed $password = '' ][, string $project = '' ]) : User
Parameters
- $requireRightToLogin : mixed = true
- $user : string = ''
-
the username of the user to authenticate
- $password : mixed = ''
- $project : string = ''
-
the project where the user should be authenticated
Tags
Return values
User —the authenticated user
checkConcurrentUsers()
Checks the maximal amount of concurrent users for a context.
public
static checkConcurrentUsers(int $maxConcurrent, string $context[, string $subcontext = '' ], string $contextID[, bool $bOutputHtml = true ]) : void
If there are too many concurrent users the window dies with an error window or exception.
Parameters
- $maxConcurrent : int
-
the maximum amount of allowed concurrent users.
- $context : string
-
the context of the access, e.g. a Suitename.
- $subcontext : string = ''
-
the subcontext of the access, e.g. a Widgetname.
- $contextID : string
-
the contextID of the access, e.g. a WidgetID.
- $bOutputHtml : bool = true
-
If bOutputHtml equals True we echo HTML error (Studio UI), else we send a Exception
Tags
Return values
void —connect()
Conntects to a CONTENTSERV project using the given username, password
public
static connect(mixed $user, mixed $password, mixed $project) : mixed
Parameters
- $user : mixed
- $password : mixed
- $project : mixed
Tags
Return values
mixed —createField()
Creates a new CSItemApiFields at the targeted position
public
static createField(string $label[, int $targetID = null ][, int $position = CSITEM_POSITION_CHILD ][, string $type = 'caption' ][, string $typemodule = 'core' ][, bool $loadTypeFromProject = false ][, bool $isConfiguration = false ]) : CSItemApiField
Parameters
- $label : string
-
the label of the new field
- $targetID : int = null
-
ID of the targeted field
- $position : int = CSITEM_POSITION_CHILD
-
position relative to the target field
- $type : string = 'caption'
-
the type of the field
- $typemodule : string = 'core'
-
name of the module the type is defined in
- $loadTypeFromProject : bool = false
-
set this flag if the type is defined in the project
- $isConfiguration : bool = false
-
set this flag to create a configuration
Tags
Return values
CSItemApiField —createGroup()
Creates a new user group at the targeted position
public
static createGroup(string $userName[, int $targetID = null ][, int $position = CSITEM_POSITION_CHILD ], int $baseFieldID) : CSUserItem
Parameters
- $userName : string
-
the user name of the new group
- $targetID : int = null
-
ID of the targeted group
- $position : int = CSITEM_POSITION_CHILD
-
position relative to the target group
- $baseFieldID : int
-
the id of the root field of the group
Tags
Return values
CSUserItem —createPasswordHash()
public
static createPasswordHash(mixed $sPassword, mixed $sSalt) : mixed
Parameters
- $sPassword : mixed
- $sSalt : mixed
Tags
Return values
mixed —createUser()
Creates a new User at the targeted position.
public
static createUser(string $userName[, int $targetID = null ][, int $position = CSITEM_POSITION_CHILD ], int $baseFieldID[, bool $isFolder = false ]) : CSUserItem
This is a synonym for the createApiItem method.
Parameters
- $userName : string
-
the userName of the new user
- $targetID : int = null
-
ID of the targeted user
- $position : int = CSITEM_POSITION_CHILD
-
position relative to the target user
- $baseFieldID : int
-
the id of the root field of the user
- $isFolder : bool = false
-
set this flag to create a group
Tags
Return values
CSUserItem —generatePassword()
Generates a new Password
public
static generatePassword() : string
This password is only created, not assigned to any specific user. See the method sendPassword to assign and inform a user about a new password.
Tags
Return values
string —the new password
generateSalt()
public
static generateSalt() : mixed
Tags
Return values
mixed —getApiFieldForExternalKey()
Returns a specific field of an item or an empty Api Field when the key is null, empty or invalid
public
getApiFieldForExternalKey(string $sExternalKey) : CSItemApiField
If you pass the ExternalKey of the field as identifier be aware that labels are not unique and the first field with that label will be returned.
Parameters
- $sExternalKey : string
-
External key of the Item (or Field)
Tags
Return values
CSItemApiField —Returns an instance of the CSItemApiField object
getComparator()
Creates a comparator object that can be used with the CSGuiItemComparatorTable
public
getComparator(CSItemComparatorData $oComparatorData) : CSItemComparator
Parameters
- $oComparatorData : CSItemComparatorData
-
CSItemComparatorData object with already setted data.
Tags
Return values
CSItemComparator —the newly created CSItemComparator-object that can be used for further configuration.
getConcurrentAccessUserIDs()
Returns the UserIDs of all users who had accessed a component at a given time
public
static getConcurrentAccessUserIDs([string $type = null ][, string $context = null ][, string $subcontext = null ][, string $contextID = null ][, int $timestamp = null ]) : array<string|int, mixed>
Parameters
- $type : string = null
-
the place where the component is accessed (e.g. backend, frontend, portal, ...). This is tried to guess if not specified.
- $context : string = null
-
the context of the access, e.g. a Suitename
- $subcontext : string = null
-
the subcontext of the access, e.g. a Widgetname
- $contextID : string = null
-
the contextID of the access, e.g. a WidgetID
- $timestamp : int = null
-
the unix timestamp to check the time for
Tags
Return values
array<string|int, mixed> —the IDs of all logged in users
getConcurrentUserIDs()
Returns the UserIDs of all users who are logged in to the backend at the moment
public
static getConcurrentUserIDs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —all logged in users
getCurrentUILanguageID()
Returns the current UI languageID of the User.
public
static getCurrentUILanguageID() : int
Tags
Return values
int —Returns the UI language ID of the user
getField()
Loads an existing field for a given ID
public
static getField([int $ID = null ]) : CSItemApiFields
Parameters
- $ID : int = null
-
of the field
Tags
Return values
CSItemApiFields —a CSItemApiFields object for the given ID
getFields()
Returns an array with CSItemApiFields matching the SQL filter condition in the given sort order and limit
public
static getFields([string $filter = '1=1' ][, string $sortorder = '' ][, mixed $limit = '' ]) : mixed
Parameters
- $filter : string = '1=1'
-
SQL Filter condition
- $sortorder : string = ''
-
SQL Sort Order
- $limit : mixed = ''
-
either a string which is a SQL limit condition or the integer 1, if only the first matching CSItemApiFields should be returned
Tags
Return values
mixed —either an array with the CSItemApiFields or the first CSItemApiField, if limit is set to 1
getInstance()
public
static getInstance(mixed $apiName[, mixed $itemClass = null ]) : mixed
Parameters
- $apiName : mixed
- $itemClass : mixed = null
Tags
Return values
mixed —getMaintenanceUsers()
Returns an array containing CSUserItems with ability to login when system has Maintenance Mode enabled.
public
static getMaintenanceUsers() : array<string|int, CSUserItem>
Tags
Return values
array<string|int, CSUserItem> —An array containing CSUserItems with ability to login when system has Maintenance Mode enabled.
getPIN()
Returns an integrated authentication Request GET Parameter of the form &CSPIN=Y3RzVXNlcj1hZG1pbmRlJm which will remain valid for seven days
public
static getPIN([mixed $ctsUser = '' ][, mixed $ctsWebsite = '' ]) : string
Parameters
- $ctsUser : mixed = ''
- $ctsWebsite : mixed = ''
Tags
Return values
string —the authentication PIN
getSearchableApiFields()
Returns an array with CSItemApiField matching the searchable condition in the given sort order and limit If $returnSimpleSearchables and $returnExtendedSearchables are set to false all fields are returned which are not searchable Otherwise the fields are returned matching at least one of the set criterias.
public
getSearchableApiFields([bool $returnSimpleSearchables = true ][, bool $returnExtendedSearchables = true ][, string $sortorder = '' ][, mixed $limit = '' ]) : mixed
Parameters
- $returnSimpleSearchables : bool = true
-
whether simple searchable fields are returned
- $returnExtendedSearchables : bool = true
-
whether extended searchable fields are returned
- $sortorder : string = ''
-
SQL Sort Order
- $limit : mixed = ''
-
either a string which is a SQL limit condition or the integer 1, if only the first matching CSItemApiField should be returned
Tags
Return values
mixed —either an array with the CSItemApiFields or the first CSItemApiField, if limit is set to 1
getSSO()
Returns an integrated authentication Request GET Parameter of the form &CSPIN=Y3RzVXNlcj1hZG1pbmRlJm which will remain valid for seven days
public
static getSSO(int $PortalID[, mixed $ctsUser = '' ][, mixed $ctsWebsite = '' ]) : string
Parameters
- $PortalID : int
-
the portal id for the PIN
- $ctsUser : mixed = ''
- $ctsWebsite : mixed = ''
Tags
Return values
string —the authentication PIN
getTicket()
public
static getTicket([int $UserID = null ], int $validUntil, int $maxLogins) : string
Parameters
- $UserID : int = null
-
the ID of the user, if empty the current user will be taken
- $validUntil : int
-
amount of seconds the ticket should be valid
- $maxLogins : int
-
maximum amount of logins the user is allowed to make using this ticket
Tags
Return values
string —the CSTicket parameter for the current user
getUser()
Returns a user from the user base
public
static getUser([string $UserID = null ]) : CSUserItem
If no UserID is passed as parameter the current user is returned.
Parameters
- $UserID : string = null
-
- ID of the user, default is the ID of the current user
Tags
Return values
CSUserItem —the user object
getUserByName()
Get the user with a given name
public
static getUserByName(string $name) : CSUser
Parameters
- $name : string
-
Username of target user
Tags
Return values
CSUser —API object of either an existing (UserID > 0) or a new user (UserID == 0)
getUserID()
Returns the ID of the current user
public
static getUserID() : int
Tags
Return values
int —The ID of the current user
getUserIds()
Returns the userIDs according to filter provided.
public
static getUserIds([string $sFilter = '1=1' ][, bool $bRecursive = true ][, mixed $sSortOrder = '' ][, mixed $mLimit = '' ]) : array<string|int, mixed>
Parameters
- $sFilter : string = '1=1'
-
Filter condition to fetch user records.
- $bRecursive : bool = true
-
If true it will fetch all children for group.
- $sSortOrder : mixed = ''
- $mLimit : mixed = ''
Tags
Return values
array<string|int, mixed> —Array of User ids
getUserIdsByAccessLevels()
Creates a two dimensional array with the first key as alls accesslevel for each user in the form RoleID1@RubricID1|RoleID2@RubricID2|... and the value an array of UserIDs having this accesslevel
public
static getUserIdsByAccessLevels([int $minRequiredUsers = 1 ][, string $sqlFilter = "1=1" ][, mixed $returnOnlyMatchingWithSubGroups = false ]) : mixed
Parameters
- $minRequiredUsers : int = 1
-
the minimum amount of users which must have the same accesslevel to be returned. The group containing the anonymous user is always returned.
- $sqlFilter : string = "1=1"
-
an sql which should be added to limit the found identities where the identity table has the alias 'identity' and the user table 'user'
- $returnOnlyMatchingWithSubGroups : mixed = false
Tags
Return values
mixed —getUserIdsByRoles()
returns an array containing all the RoleIDs as key and an array of UserIds as value
public
static getUserIdsByRoles([array<string|int, mixed> $RoleIDs = array() ][, mixed $returnOnlyMatchingWithSubGroups = false ]) : array<string|int, mixed>
Parameters
- $RoleIDs : array<string|int, mixed> = array()
-
an array with RoleIDs
- $returnOnlyMatchingWithSubGroups : mixed = false
Tags
Return values
array<string|int, mixed> —matching RoleIDs to an array of UsersIds
getUserIdsForIdentities()
Returns all users with the given accesslevels and/or roles
public
static getUserIdsForIdentities([array<string|int, mixed> $rubricIDs = array() ][, mixed $roleIDs = array() ]) : array<string|int, mixed>
Parameters
- $rubricIDs : array<string|int, mixed> = array()
-
the allowed Accesslevels
- $roleIDs : mixed = array()
Tags
Return values
array<string|int, mixed> —all matching UserIDs
getUserIdsWithRights()
returns an array containing all the UserIds having all the requested rights
public
static getUserIdsWithRights([array<string|int, mixed> $RightFilters = array() ][, string $userFilter = '' ][, bool $returnOnlyCount = false ]) : mixed
Parameters
- $RightFilters : array<string|int, mixed> = array()
-
an array of sql filters describing all requested Rights, e.g. array("Module LIKE 'pages' AND RightName LIKE 'edit%'", "Module LIKE 'user' AND RightName LIKE 'setup'")
- $userFilter : string = ''
-
a sql filter to filter the returned users.
- $returnOnlyCount : bool = false
-
only count whether all IDs (false) or only the count (true) should be returned.
Tags
Return values
mixed —eitheran array of matching UsersIDs or the count as integer (if $returnOnlyCount is set to true)
getUserName()
Returns a UserName from the user base
public
static getUserName([string $UserID = null ]) : string
If no UserID is passed as parameter the current UserName is returned.
Parameters
- $UserID : string = null
-
- ID of the user, default is the ID of the current user
Tags
Return values
string —the UserName of the user
getUserRoles()
Returns a user's roles as objects.
public
static getUserRoles([mixed $mUserIdOrName = NULL ]) : array<string|int, mixed>
Parameters
- $mUserIdOrName : mixed = NULL
-
Either the numerical user ID or the corresponding user name. If omitted, the current user will be assumed.
Tags
Return values
array<string|int, mixed> —The specified user's roles as an array of Role objects. The key designates the RoleID.
getUserRolesNames()
Returns a user's roles as display names.
public
static getUserRolesNames([mixed $mUserIdOrName = NULL ]) : array<string|int, mixed>
Parameters
- $mUserIdOrName : mixed = NULL
-
Either the numerical user ID or the corresponding user name. If omitted, the current user will be assumed.
Tags
Return values
array<string|int, mixed> —An array of strings containing the display names of the specified user's roles. The key designates the RoleID.
getUsers()
Returns an array with CSUserItems matching the SQL filter condition in the given sort order and limit.
public
static getUsers([string $filter = '1=1' ][, string $sortorder = '' ][, mixed $limit = '' ][, bool $ignoreRights = false ]) : mixed
This is a synonym for the getItems method and therefore all special syntax described there can be used.
Parameters
- $filter : string = '1=1'
-
SQL Filter condition
- $sortorder : string = ''
-
SQL Sort Order
- $limit : mixed = ''
-
either a string which is a SQL limit condition or the integer 1, if only the first matching CSUserItem should be returned
- $ignoreRights : bool = false
-
whether the user rights should be ignored. If not only those views are returned the user may view.
Tags
Return values
mixed —either an array with the CSUserItems or the first CSUserItem, if limit is set to 1
getUserValue()
Returns a user value from the user base
public
static getUserValue(string $name[, string $UserID = null ]) : string
If no UserID is passed as parameter the value of the current user is returned.
Parameters
- $name : string
-
- name of the desired user parameter, e.g. LastName
- $UserID : string = null
-
- ID of the user, default is the ID of the current user
Tags
Return values
string —the value of the named parameter
getValueGetter()
Returns a new CSItemValueGetter object
public
static getValueGetter(mixed $mName) : CSItemValueGetter
Parameters
- $mName : mixed
-
The name of the attribute to retrieve
Tags
Return values
CSItemValueGetter —getValueSetter()
Returns a new CSItemValueSetter object
public
static getValueSetter(mixed $mName, mixed $mValue) : CSItemValueSetter
Parameters
- $mName : mixed
-
The name of the attribute to retrieve
- $mValue : mixed
Tags
Return values
CSItemValueSetter —getValuesGetter()
Returns a new CSItemValuesGetter object
public
static getValuesGetter(array<string|int, mixed> $aNames) : CSItemValuesGetter
Parameters
- $aNames : array<string|int, mixed>
-
List of attributes to be retrieved.
Tags
Return values
CSItemValuesGetter —getValuesSetter()
Returns a new CSItemValuesSetter object
public
static getValuesSetter() : CSItemValuesSetter
Tags
Return values
CSItemValuesSetter —hasAcceptedTermsOfUse()
Validates if a specific user has accepted the terms of use
public
static hasAcceptedTermsOfUse(int $iUserId) : bool
Parameters
- $iUserId : int
-
Id of the user to validate the terms acceptance
Tags
Return values
bool —true, if it has accepted the terms, false otherwise
hasLoginPermissions()
Check if the user can login by verifying the permission passed as parameter
public
static hasLoginPermissions(object|int $mUser[, int $iCheckLoginPermissions = self::CHECK_LOGIN_PERMISSION_ALL ]) : bool
Parameters
- $mUser : object|int
-
User object or User id
- $iCheckLoginPermissions : int = self::CHECK_LOGIN_PERMISSION_ALL
-
Int permissions to be verified
Tags
Return values
bool —true if the user can login
isAnonymousUser()
Checks if the current user (or the one with the specified id) defines an anonymous user.
public
static isAnonymousUser([int $iUserId = null ]) : bool
Parameters
- $iUserId : int = null
-
The user id to check if it belongs to the anonymous user.
Tags
Return values
bool —True, if the check reveals an anonymous user, otherwise false.
isAuthenticated()
Returns whether the current user is authenticated or the 'Anonymous'
public
static isAuthenticated() : bool
Tags
Return values
bool —whether the user is authenticated
limitAllowedHtmlTags()
Limits all tags which are allowed in the formatted value result of any item This can e.g. be used for media neutral exports where not all html tags are supported
public
static limitAllowedHtmlTags([array<string|int, mixed> $htmlTags = array() ]) : mixed
Parameters
- $htmlTags : array<string|int, mixed> = array()
-
an array containing all allowed HTML Tags. If it is an empty array, no html tags are allowed
Tags
Return values
mixed —logAccess()
Logs the access of the user to a component in the Uservisit table. An access is only logged, if the last access is older than the PingTimeout in the Options or 300 seconds.
public
static logAccess([string $type = null ][, string $context = '' ][, string $subcontext = '' ], int $contextID[, bool $bForceLogging = FALSE ]) : void
Parameters
- $type : string = null
-
the place where the component is accessed (e.g. backend, frontend, portal, ...). This is tried to guess if not specified.
- $context : string = ''
-
the context of the access, e.g. a Suitename
- $subcontext : string = ''
-
the subcontext of the access, e.g. a Widget name
- $contextID : int
-
the optional ID of the access, e.g. a Widget ID
- $bForceLogging : bool = FALSE
-
whether the access should always be logged (even if log level is set to 0)
Tags
Return values
void —logout()
Ends the current session and sets the current user to 'Anonymous'
public
static logout([bool $bMarkLogoutInCurrentUser = TRUE ]) : mixed
Parameters
- $bMarkLogoutInCurrentUser : bool = TRUE
-
whether the logout should be marked in the current logged in user
Tags
Return values
mixed —may()
Returns a right from the user administration It is recommended to use the Records isAllowed([RIGHT]) method instead to ensure that all concepts like Accesslevels, fallbacks, ... are used.
public
static may(string $Module, string $RightName[, string $ID = "" ][, int $recordClass = "" ]) : bool
Parameters
- $Module : string
-
- name of the module the right refers to
- $RightName : string
-
- name of the right
- $ID : string = ""
-
- optional ID if the right should explicitly be available for the given Record
- $recordClass : int = ""
-
the optional record for which the ID is provided.
Tags
Return values
bool —true if the right is available, false otherwise
mayUse()
Returns the right to use a module
public
static mayUse(string $Module) : bool
Parameters
- $Module : string
-
- name of the module the right refers to
Tags
Return values
bool —true if the right is available, false otherwise
resetTermsOfUse()
Resets the terms of use for all users. Necessary when the terms are updated
public
static resetTermsOfUse() : bool
Tags
Return values
bool —whether the reset of the terms was successful
sendNewPassword()
Assigns a new password to a user or group and sends it by e-mail
public
static sendNewPassword(mixed $UserIDs[, bool $recursive = true ][, string $templateFolder = null ]) : void
This method assigns new passwords to a user and optionally the children, if the user is a group. Users without e-mail, the admin and Anonymous account and the current user are skipped.
Parameters
- $UserIDs : mixed
-
the ID of the user or group as a int or as an array of ints
- $recursive : bool = true
-
if true (default) the passwords are also generated for the group members
- $templateFolder : string = null
-
path to a folder with two template files expected there as folder/Mail.Sendpassword.Password.xml and folder/Mail.Sendpassword.User.xml
Tags
Return values
void —sendPasswordResetLink()
Sends an email with the password reset link for the given users
public
static sendPasswordResetLink(array<string|int, mixed> $aUserIds[, string $sReason = CSUser::PASSWORD_RESET_REASON_REQUEST ][, bool $bRecursive = false ][, string $sTemplatePath = '' ]) : array<string|int, mixed>
Parameters
- $aUserIds : array<string|int, mixed>
-
The Ids of the users that should have their password reset
- $sReason : string = CSUser::PASSWORD_RESET_REASON_REQUEST
-
String with the reason for the password reset (can be one of the PASSWORD_RESET_REASON_* constants)
- $bRecursive : bool = false
-
Flag to indicate if the reset should be done recursively
- $sTemplatePath : string = ''
-
Path to the email template to be sent
Tags
Return values
array<string|int, mixed> —switchToUser()
Switches the current user to another user in this request.
public
static switchToUser([string $UserID = null ]) : void
The original user still remains in the session and might be restored using this method again without given $UserID.
Parameters
- $UserID : string = null
-
the ID of the user to switch to or null to restore the last user
