User
Table of Contents
Methods
- checkAccessOperationInLevel() : mixed
- extractPublicData() : array<string|int, mixed>
- Extract user data suitable to publicise using json_encode() or CUtil::PhpToJsObject()
- formatName() : mixed
- get() : CUser
- getAbsences() : array<string|int, mixed>
- getAccessLevel() : null
- Get access level by name
- getAccessLevelsForEntity() : array<string|int, mixed>
- Get info about access tasks for entity
- getAccessOperationsForEntity() : array<string|int, mixed>
- Get access operations for entity
- getAdminId() : bool|int|null
- Get admin user ID
- getArtificialExternalAuthIds() : mixed
- getData() : array<string|int, mixed>
- Return data for users we really can see
- getId() : int
- Returns current user ID
- getList() : mixed
- getOccurAsId() : null
- Return user id previously set by setOccurAsId()
- getOption() : mixed
- getPublicDataKeys() : mixed
- getTime() : int
- getTimeZoneOffset() : mixed
- getTimeZoneOffsetCurrentUser() : mixed
- getUserName() : array<string|int, mixed>
- isAbsence() : array<string|int, mixed>|false
- isActive() : bool
- Check if a given user is active
- isAdmin() : bool
- Check if a user with a given id is admin
- isAuthorized() : bool
- Checks if the current user is authorized
- isBoss() : mixed
- isBossRecursively() : bool
- Checks if $bossId is a boss for $userId recursively through the structure
- isExternalUser() : bool
- Check if user is extranet user
- isSuper() : bool
- Practically, just an alias for static::isAdmin()
- mapAccessOperationNames() : mixed
- Get access operation IDs by given names
- setOccurAsId() : string
- Set user id that will figure in all logs and notifications as the user performed an action.
- setOption() : mixed
- unSetOption() : mixed
- unSetOptionForAll() : mixed
Methods
checkAccessOperationInLevel()
public
static checkAccessOperationInLevel(mixed $operationId, mixed $levelId) : mixed
Parameters
- $operationId : mixed
- $levelId : mixed
extractPublicData()
Extract user data suitable to publicise using json_encode() or CUtil::PhpToJsObject()
public
static extractPublicData(array<string|int, mixed> $user) : array<string|int, mixed>
Parameters
- $user : array<string|int, mixed>
Return values
array<string|int, mixed>formatName()
public
static formatName(mixed $data[, mixed $siteId = false ][, mixed $format = null ][, bool $allowEmpty = false ]) : mixed
Parameters
- $data : mixed
- $siteId : mixed = false
- $format : mixed = null
- $allowEmpty : bool = false
get()
public
static get() : CUser
Return values
CUsergetAbsences()
public
static getAbsences(DateTime $from, DateTime $to, int ...$userIds) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>getAccessLevel()
Get access level by name
public
static getAccessLevel(mixed $entityName, mixed $levelName) : null
Parameters
- $entityName : mixed
- $levelName : mixed
Return values
nullgetAccessLevelsForEntity()
Get info about access tasks for entity
public
static getAccessLevelsForEntity(mixed $entityName) : array<string|int, mixed>
Parameters
- $entityName : mixed
Return values
array<string|int, mixed>getAccessOperationsForEntity()
Get access operations for entity
public
static getAccessOperationsForEntity(mixed $entityName) : array<string|int, mixed>
Parameters
- $entityName : mixed
Tags
Return values
array<string|int, mixed>getAdminId()
Get admin user ID
public
static getAdminId() : bool|int|null
Return values
bool|int|nullgetArtificialExternalAuthIds()
public
static getArtificialExternalAuthIds() : mixed
getData()
Return data for users we really can see
public
static getData(array<string|int, mixed> $userIds[, array<string|int, mixed> $select = ['*'] ]) : array<string|int, mixed>
todo: make static cache here, call this function everywhere (at least, in CTaskNotifications)
Parameters
- $userIds : array<string|int, mixed>
- $select : array<string|int, mixed> = ['*']
Return values
array<string|int, mixed>getId()
Returns current user ID
public
static getId() : int
Return values
intgetList()
public
static getList(mixed $params) : mixed
Parameters
- $params : mixed
getOccurAsId()
Return user id previously set by setOccurAsId()
public
static getOccurAsId() : null
Return values
nullgetOption()
public
static getOption(mixed $name[, mixed $userId = 0 ][, mixed $default = '' ]) : mixed
Parameters
- $name : mixed
- $userId : mixed = 0
- $default : mixed = ''
getPublicDataKeys()
public
static getPublicDataKeys() : mixed
getTime()
public
static getTime([int $userId = 0 ]) : int
Parameters
- $userId : int = 0
Return values
intgetTimeZoneOffset()
public
static getTimeZoneOffset([mixed $userId = 0 ][, mixed $utc = false ][, bool $force = false ]) : mixed
Parameters
- $userId : mixed = 0
- $utc : mixed = false
- $force : bool = false
getTimeZoneOffsetCurrentUser()
public
static getTimeZoneOffsetCurrentUser() : mixed
getUserName()
public
static getUserName(array<string|int, mixed> $userIds[, mixed $siteId = null ][, mixed $nameTemplate = null ][, bool $allowEmpty = false ][, array<string|int, mixed> $select = ['default'] ]) : array<string|int, mixed>
Parameters
- $userIds : array<string|int, mixed>
- $siteId : mixed = null
- $nameTemplate : mixed = null
- $allowEmpty : bool = false
- $select : array<string|int, mixed> = ['default']
Return values
array<string|int, mixed>isAbsence()
public
static isAbsence(array<string|int, mixed> $userIds) : array<string|int, mixed>|false
Parameters
- $userIds : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>|falseisActive()
Check if a given user is active
public
static isActive(mixed $userId) : bool
Parameters
- $userId : mixed
Tags
Return values
boolisAdmin()
Check if a user with a given id is admin
public
static isAdmin([0 $userId = 0 ]) : bool
Parameters
- $userId : 0 = 0
Return values
boolisAuthorized()
Checks if the current user is authorized
public
static isAuthorized() : bool
Return values
boolisBoss()
public
static isBoss(mixed $userId, mixed $bossId) : mixed
Parameters
- $userId : mixed
- $bossId : mixed
isBossRecursively()
Checks if $bossId is a boss for $userId recursively through the structure
public
static isBossRecursively(mixed $bossId, mixed $userId) : bool
Parameters
- $bossId : mixed
- $userId : mixed
Return values
boolisExternalUser()
Check if user is extranet user
public
static isExternalUser(int $userID) : bool
Parameters
- $userID : int
-
User ID
Return values
boolisSuper()
Practically, just an alias for static::isAdmin()
public
static isSuper([int $userId = 0 ]) : bool
Parameters
- $userId : int = 0
Return values
boolmapAccessOperationNames()
Get access operation IDs by given names
public
static mapAccessOperationNames(mixed $entityName, array<string|int, mixed> $names) : mixed
Parameters
- $entityName : mixed
- $names : array<string|int, mixed>
setOccurAsId()
Set user id that will figure in all logs and notifications as the user performed an action.
public
static setOccurAsId([int $userId = 0 ]) : string
This allows to create task task under admin id and put to log someone else.
In general, this is a hacky function, so it could be set deprecated in future as architecture changes.
Parameters
- $userId : int = 0
-
Use 0 or null or false to switch off user replacement
Return values
stringsetOption()
public
static setOption(mixed $name, mixed $value[, mixed $userId = 0 ][, bool $common = false ]) : mixed
Parameters
- $name : mixed
- $value : mixed
- $userId : mixed = 0
- $common : bool = false
unSetOption()
public
static unSetOption(mixed $name[, mixed $userId = 0 ]) : mixed
Parameters
- $name : mixed
- $userId : mixed = 0
unSetOptionForAll()
public
static unSetOptionForAll(mixed $name) : mixed
Parameters
- $name : mixed