Bitrix API

CUser extends CAllUser

Table of Contents

Constants

PASSWORD_SPECIAL_CHARS  = ',.<>/?;:\'"[]{}\|`~!@#$%^&*()_+=-'
PHONE_CODE_OTP_INTERVAL  = 30
PHONE_CODE_RESEND_INTERVAL  = 60
STATUS_OFFLINE  = 'offline'
STATUS_ONLINE  = 'online'

Properties

$LAST_ERROR  : mixed

Methods

__construct()  : mixed
CUser constructor.
Add()  : mixed
AddHitAuthHash()  : mixed
AppendUserGroup()  : mixed
Appends groups to the list of existing user's groups.
AuthActionsCleanUpAgent()  : mixed
Authorize()  : bool
Performs the user authorization: fills session parameters; remembers auth; spreads auth through sites.
AuthorizeWithOtp()  : mixed
CanAccess()  : mixed
CanAccessFile()  : bool
Checks if the current user can access the file content.
CanDoFileOperation()  : mixed
CanDoOperation()  : mixed
ChangePassword()  : mixed
CheckAuthActions()  : mixed
CheckFields()  : mixed
CheckInternalFields()  : string
CheckPasswordAgainstPolicy()  : mixed
CheckStoredHash()  : mixed
CleanUpAgent()  : mixed
CleanUpHitAuthAgent()  : mixed
clearUserGroupCache()  : mixed
DeactivateAgent()  : mixed
Delete()  : mixed
FormatLastActivityDate()  : string
FormatName()  : mixed
GeneratePasswordByPolicy()  : mixed
GeneratePhoneCode()  : array<string|int, mixed>|bool
GetAccessCodes()  : mixed
GetActiveUsersCount()  : mixed
GetAllOperations()  : mixed
GetByID()  : mixed
GetByLogin()  : mixed
getContext()  : Context
Returns the current authentication context, stored in the session.
GetCount()  : mixed
GetDropDownList()  : mixed
GetEmail()  : mixed
GetExternalAuthList()  : mixed
GetExternalUserTypes()  : mixed
GetFileOperations()  : mixed
GetFirstName()  : mixed
GetFormattedName()  : mixed
GetFullName()  : mixed
GetGroupPolicy()  : mixed
GetGroups()  : mixed
GetHitAuthHash()  : mixed
GetID()  : mixed
GetLastName()  : mixed
GetList()  : mixed
GetLogin()  : mixed
getLogoutParams()  : string
GetOnlineStatus()  : mixed
GetParam()  : mixed
getPolicy()  : RulesCollection
GetSecondName()  : mixed
GetSecondsForLimitOnline()  : mixed
GetSecurityPolicy()  : mixed
GetSubordinateGroups()  : array<string|int, mixed>
GetUserGroup()  : mixed
GetUserGroupArray()  : mixed
GetUserGroupEx()  : mixed
GetUserGroupList()  : mixed
GetUserGroupString()  : mixed
HasNoAccess()  : mixed
IsAdmin()  : mixed
IsAuthorized()  : mixed
IsJustAuthorized()  : mixed
IsJustBecameOnline()  : mixed
IsOnLine()  : mixed
Login()  : array<string|int, mixed>|bool
Authenticates the user and then authorizes him
LoginAs()  : bool
LoginByCookies()  : mixed
LoginByDigest()  : mixed
LoginByHash()  : mixed
LoginByHttpAuth()  : mixed
LoginByOtp()  : mixed
LoginHitByHash()  : mixed
LoginInternal()  : int
Internal authentication by login and password.
Logout()  : mixed
Register()  : mixed
RemoveUserGroup()  : void
Removes groups from the existing user's groups.
RequiredHTTPAuthBasic()  : mixed
SearchUserByName()  : mixed
SendPassword()  : mixed
SendPhoneCode()  : Result
SendUserInfo()  : mixed
Sends a profile information to email
SetControllerAdmin()  : mixed
SetLastActivityDate()  : mixed
SetLastActivityDateByArray()  : mixed
SetParam()  : mixed
SetUserGroup()  : mixed
SetUserGroupArray()  : mixed
SimpleRegister()  : mixed
UnblockAgent()  : mixed
Update()  : mixed
UpdateDigest()  : mixed
UpdateSessionData()  : mixed
UserTypeRightsCheck()  : mixed
VerifyPhoneCode()  : bool|int

Constants

PASSWORD_SPECIAL_CHARS

public mixed PASSWORD_SPECIAL_CHARS = ',.<>/?;:\'"[]{}\|`~!@#$%^&*()_+=-'

PHONE_CODE_OTP_INTERVAL

public mixed PHONE_CODE_OTP_INTERVAL = 30

PHONE_CODE_RESEND_INTERVAL

public mixed PHONE_CODE_RESEND_INTERVAL = 60

STATUS_OFFLINE

public mixed STATUS_OFFLINE = 'offline'

STATUS_ONLINE

public mixed STATUS_ONLINE = 'online'

Properties

$LAST_ERROR

public mixed $LAST_ERROR = ''

Methods

__construct()

CUser constructor.

public __construct() : mixed

Add()

public Add(mixed $arFields) : mixed
Parameters
$arFields : mixed

AddHitAuthHash()

public static AddHitAuthHash(mixed $url[, mixed $user_id = false ][, mixed $site_id = false ][, mixed $ttl = null ]) : mixed
Parameters
$url : mixed
$user_id : mixed = false
$site_id : mixed = false
$ttl : mixed = null

AppendUserGroup()

Appends groups to the list of existing user's groups.

public static AppendUserGroup(int $userId, array<string|int, mixed>|int $groups) : mixed
Parameters
$userId : int
$groups : array<string|int, mixed>|int

A single number, or an array of numbers, or an array of arrays("GROUP_ID"=>$val, "DATE_ACTIVE_FROM"=>$val, "DATE_ACTIVE_TO"=>$val)

AuthActionsCleanUpAgent()

public static AuthActionsCleanUpAgent() : mixed

Authorize()

Performs the user authorization: fills session parameters; remembers auth; spreads auth through sites.

public Authorize(Context|int $context[, bool $bSave = false ][, bool $bUpdate = true ][, string|null $applicationId = null ][, mixed $onlyActive = true ]) : bool
Parameters
$context : Context|int

Contains user id.

$bSave : bool = false

Save authorization in cookies.

$bUpdate : bool = true

Update last login information in DB.

$applicationId : string|null = null

An application password ID.

$onlyActive : mixed = true
Return values
bool

AuthorizeWithOtp()

public AuthorizeWithOtp(mixed $user_id[, mixed $bSave = false ]) : mixed
Parameters
$user_id : mixed
$bSave : mixed = false

CanAccess()

public CanAccess(mixed $arCodes) : mixed
Parameters
$arCodes : mixed

CanAccessFile()

Checks if the current user can access the file content.

public CanAccessFile(string $path[, string|null $site = null ]) : bool

Only admin can view content of PHP files.

Parameters
$path : string
$site : string|null = null
Return values
bool

CanDoFileOperation()

public CanDoFileOperation(mixed $op_name, mixed $arPath) : mixed
Parameters
$op_name : mixed
$arPath : mixed

CanDoOperation()

public CanDoOperation(mixed $op_name[, mixed $user_id = 0 ]) : mixed
Parameters
$op_name : mixed
$user_id : mixed = 0

ChangePassword()

public ChangePassword(mixed $LOGIN, mixed $CHECKWORD, mixed $PASSWORD, mixed $CONFIRM_PASSWORD[, mixed $SITE_ID = false ][, mixed $captcha_word = '' ][, mixed $captcha_sid = 0 ][, mixed $authActions = true ][, mixed $phoneNumber = '' ][, mixed $currentPassword = '' ]) : mixed
Parameters
$LOGIN : mixed
$CHECKWORD : mixed
$PASSWORD : mixed
$CONFIRM_PASSWORD : mixed
$SITE_ID : mixed = false
$captcha_word : mixed = ''
$captcha_sid : mixed = 0
$authActions : mixed = true
$phoneNumber : mixed = ''
$currentPassword : mixed = ''

CheckAuthActions()

public CheckAuthActions() : mixed

CheckFields()

public CheckFields(mixed &$arFields[, mixed $ID = false ]) : mixed
Parameters
$arFields : mixed
$ID : mixed = false

CheckInternalFields()

public static CheckInternalFields(array<string|int, mixed> $arFields[, int|bool $ID = false ]) : string
Parameters
$arFields : array<string|int, mixed>
$ID : int|bool = false
Return values
string

CheckPasswordAgainstPolicy()

public static CheckPasswordAgainstPolicy(mixed $password, mixed $arPolicy[, mixed $userId = null ]) : mixed
Parameters
$password : mixed
$arPolicy : mixed
$userId : mixed = null

CheckStoredHash()

public static CheckStoredHash(mixed $context, mixed $hash[, mixed $tempHash = false ]) : mixed
Parameters
$context : mixed
$hash : mixed
$tempHash : mixed = false

CleanUpAgent()

public static CleanUpAgent() : mixed

CleanUpHitAuthAgent()

public static CleanUpHitAuthAgent() : mixed

clearUserGroupCache()

public static clearUserGroupCache([mixed $ID = false ]) : mixed
Parameters
$ID : mixed = false

DeactivateAgent()

public static DeactivateAgent() : mixed

Delete()

public static Delete(mixed $ID) : mixed
Parameters
$ID : mixed

FormatLastActivityDate()

public static FormatLastActivityDate(int|bool|DateTime $timestamp[, int|bool|DateTime $now = false ]) : string
Parameters
$timestamp : int|bool|DateTime
$now : int|bool|DateTime = false
Return values
string

FormatName()

public static FormatName(mixed $NAME_TEMPLATE, mixed $arUser[, mixed $bUseLogin = false ][, mixed $bHTMLSpec = true ][, mixed $enabledEmptyNameStub = true ]) : mixed
Parameters
$NAME_TEMPLATE : mixed
$arUser : mixed
$bUseLogin : mixed = false
$bHTMLSpec : mixed = true
$enabledEmptyNameStub : mixed = true

GeneratePasswordByPolicy()

public static GeneratePasswordByPolicy(array<string|int, mixed> $groups) : mixed
Parameters
$groups : array<string|int, mixed>

GeneratePhoneCode()

public static GeneratePhoneCode(int $userId) : array<string|int, mixed>|bool
Parameters
$userId : int
Return values
array<string|int, mixed>|bool

[code, phone_number]

GetAccessCodes()

public GetAccessCodes() : mixed

GetActiveUsersCount()

public static GetActiveUsersCount() : mixed

GetAllOperations()

public GetAllOperations([mixed $arGroups = false ]) : mixed
Parameters
$arGroups : mixed = false

GetByID()

public static GetByID(mixed $ID) : mixed
Parameters
$ID : mixed

GetByLogin()

public static GetByLogin(mixed $LOGIN) : mixed
Parameters
$LOGIN : mixed

getContext()

Returns the current authentication context, stored in the session.

public getContext() : Context
Return values
Context

GetCount()

public static GetCount([mixed $maxCount = 0 ]) : mixed
Parameters
$maxCount : mixed = 0

GetDropDownList()

public static GetDropDownList([mixed $strSqlSearch = "and ACTIVE='Y'" ][, mixed $strSqlOrder = "ORDER BY ID, NAME, LAST_NAME" ]) : mixed
Parameters
$strSqlSearch : mixed = "and ACTIVE='Y'"
$strSqlOrder : mixed = "ORDER BY ID, NAME, LAST_NAME"

GetEmail()

public GetEmail() : mixed

GetExternalAuthList()

public static GetExternalAuthList() : mixed

GetExternalUserTypes()

public static GetExternalUserTypes() : mixed

GetFileOperations()

public static GetFileOperations(mixed $arPath[, mixed $arGroups = false ]) : mixed
Parameters
$arPath : mixed
$arGroups : mixed = false

GetFirstName()

public GetFirstName() : mixed

GetFormattedName()

public GetFormattedName([mixed $bUseBreaks = true ][, mixed $bHTMLSpec = true ]) : mixed
Parameters
$bUseBreaks : mixed = true
$bHTMLSpec : mixed = true

GetFullName()

public GetFullName() : mixed

GetGroupPolicy()

public static GetGroupPolicy(mixed $iUserId) : mixed
Parameters
$iUserId : mixed

GetGroups()

public GetGroups() : mixed

GetHitAuthHash()

public static GetHitAuthHash(mixed $urlMask[, mixed $userID = false ][, mixed $siteId = null ]) : mixed
Parameters
$urlMask : mixed
$userID : mixed = false
$siteId : mixed = null

GetID()

public GetID() : mixed

GetLastName()

public GetLastName() : mixed

GetList()

public static GetList([mixed $by = '' ][, mixed $order = '' ][, mixed $arFilter = [] ][, mixed $arParams = [] ]) : mixed
Parameters
$by : mixed = ''
$order : mixed = ''
$arFilter : mixed = []
$arParams : mixed = []

GetLogin()

public GetLogin() : mixed

getLogoutParams()

public static getLogoutParams([array<string|int, mixed>|true $deleteParms = [] ]) : string
Parameters
$deleteParms : array<string|int, mixed>|true = []

Parameters to delete; if true, delete all

Return values
string

GetOnlineStatus()

public static GetOnlineStatus(mixed $userId, mixed $lastseen[, mixed $now = false ]) : mixed
Parameters
$userId : mixed
$lastseen : mixed
$now : mixed = false

GetParam()

public GetParam(mixed $name) : mixed
Parameters
$name : mixed

getPolicy()

public static getPolicy(mixed $userId) : RulesCollection
Parameters
$userId : mixed

User ID or array of groups

Return values
RulesCollection

GetSecondName()

public GetSecondName() : mixed

GetSecondsForLimitOnline()

public static GetSecondsForLimitOnline() : mixed

GetSecurityPolicy()

public GetSecurityPolicy() : mixed

GetSubordinateGroups()

public static GetSubordinateGroups([int $userID = null ]) : array<string|int, mixed>
Parameters
$userID : int = null
Return values
array<string|int, mixed>

GetUserGroup()

public static GetUserGroup(mixed $ID) : mixed
Parameters
$ID : mixed

GetUserGroupArray()

public GetUserGroupArray() : mixed

GetUserGroupEx()

public static GetUserGroupEx(mixed $ID) : mixed
Parameters
$ID : mixed

GetUserGroupList()

public static GetUserGroupList(mixed $ID) : mixed
Parameters
$ID : mixed

GetUserGroupString()

public GetUserGroupString() : mixed

HasNoAccess()

public HasNoAccess() : mixed

IsAdmin()

public IsAdmin() : mixed

IsAuthorized()

public IsAuthorized() : mixed

IsJustAuthorized()

public IsJustAuthorized() : mixed

IsJustBecameOnline()

public IsJustBecameOnline() : mixed

IsOnLine()

public static IsOnLine(mixed $id[, mixed $interval = null ]) : mixed
Parameters
$id : mixed
$interval : mixed = null

Login()

Authenticates the user and then authorizes him

public Login(string $login, string $password[, string $remember = 'N' ][, string $password_original = 'Y' ]) : array<string|int, mixed>|bool
Parameters
$login : string
$password : string
$remember : string = 'N'
$password_original : string = 'Y'
Return values
array<string|int, mixed>|bool

LoginAs()

public LoginAs(int $userId) : bool
Parameters
$userId : int
Return values
bool

LoginByCookies()

public LoginByCookies() : mixed

LoginByDigest()

public LoginByDigest(mixed $arDigest) : mixed
Parameters
$arDigest : mixed

LoginByHash()

public LoginByHash(mixed $login, mixed $hash) : mixed
Parameters
$login : mixed
$hash : mixed

LoginByHttpAuth()

public LoginByHttpAuth() : mixed

LoginByOtp()

public LoginByOtp(mixed $otp[, mixed $remember_otp = 'N' ][, mixed $captcha_word = '' ][, mixed $captcha_sid = '' ]) : mixed
Parameters
$otp : mixed
$remember_otp : mixed = 'N'
$captcha_word : mixed = ''
$captcha_sid : mixed = ''

LoginHitByHash()

public LoginHitByHash(mixed $hash[, mixed $closeSession = true ][, mixed $delete = false ][, mixed $remember = false ]) : mixed
Parameters
$hash : mixed
$closeSession : mixed = true
$delete : mixed = false
$remember : mixed = false

LoginInternal()

Internal authentication by login and password.

public static LoginInternal(array<string|int, mixed> &$arParams[, array<string|int, mixed>|bool &$result_message = true ][, Context|null $context = null ][, array<string|int, mixed> &$error = [] ]) : int
Parameters
$arParams : array<string|int, mixed>
$result_message : array<string|int, mixed>|bool = true
$context : Context|null = null
$error : array<string|int, mixed> = []
Return values
int

User ID on success or 0 on failure. Additionally, $result_message will hold an error.

Logout()

public Logout() : mixed

Register()

public Register(mixed $USER_LOGIN, mixed $USER_NAME, mixed $USER_LAST_NAME, mixed $USER_PASSWORD, mixed $USER_CONFIRM_PASSWORD, mixed $USER_EMAIL[, mixed $SITE_ID = false ][, mixed $captcha_word = '' ][, mixed $captcha_sid = 0 ][, mixed $bSkipConfirm = false ][, mixed $USER_PHONE_NUMBER = '' ]) : mixed
Parameters
$USER_LOGIN : mixed
$USER_NAME : mixed
$USER_LAST_NAME : mixed
$USER_PASSWORD : mixed
$USER_CONFIRM_PASSWORD : mixed
$USER_EMAIL : mixed
$SITE_ID : mixed = false
$captcha_word : mixed = ''
$captcha_sid : mixed = 0
$bSkipConfirm : mixed = false
$USER_PHONE_NUMBER : mixed = ''

RemoveUserGroup()

Removes groups from the existing user's groups.

public static RemoveUserGroup(int $userId, array<string|int, mixed> $groups) : void
Parameters
$userId : int
$groups : array<string|int, mixed>

An array of group IDs.

RequiredHTTPAuthBasic()

public RequiredHTTPAuthBasic([mixed $Realm = "Bitrix" ]) : mixed
Parameters
$Realm : mixed = "Bitrix"

SearchUserByName()

public static SearchUserByName(mixed $arName[, mixed $email = '' ][, mixed $bLoginMode = false ]) : mixed
Parameters
$arName : mixed
$email : mixed = ''
$bLoginMode : mixed = false

SendPassword()

public static SendPassword(mixed $LOGIN, mixed $EMAIL[, mixed $SITE_ID = false ][, mixed $captcha_word = '' ][, mixed $captcha_sid = 0 ][, mixed $phoneNumber = '' ][, mixed $shortCode = false ]) : mixed
Parameters
$LOGIN : mixed
$EMAIL : mixed
$SITE_ID : mixed = false
$captcha_word : mixed = ''
$captcha_sid : mixed = 0
$phoneNumber : mixed = ''
$shortCode : mixed = false

SendPhoneCode()

public static SendPhoneCode(string $phoneNumber, string $smsTemplate[, string|null $siteId = null ]) : Result
Parameters
$phoneNumber : string
$smsTemplate : string
$siteId : string|null = null
Return values
Result

SendUserInfo()

Sends a profile information to email

public static SendUserInfo(mixed $ID, mixed $SITE_ID, mixed $MSG[, mixed $bImmediate = false ][, mixed $eventName = "USER_INFO" ][, mixed $checkword = null ]) : mixed
Parameters
$ID : mixed
$SITE_ID : mixed
$MSG : mixed
$bImmediate : mixed = false
$eventName : mixed = "USER_INFO"
$checkword : mixed = null

SetControllerAdmin()

public SetControllerAdmin([mixed $isAdmin = true ]) : mixed
Parameters
$isAdmin : mixed = true

SetLastActivityDate()

public static SetLastActivityDate([mixed $userId = null ][, mixed $cache = false ]) : mixed
Parameters
$userId : mixed = null
$cache : mixed = false

SetLastActivityDateByArray()

public static SetLastActivityDateByArray(mixed $arUsers[, mixed $ip = null ]) : mixed
Parameters
$arUsers : mixed
$ip : mixed = null

SetParam()

public SetParam(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed

SetUserGroup()

public static SetUserGroup(mixed $USER_ID, mixed $arGroups[, mixed $newUser = false ]) : mixed
Parameters
$USER_ID : mixed
$arGroups : mixed
$newUser : mixed = false

SetUserGroupArray()

public SetUserGroupArray(mixed $arr) : mixed
Parameters
$arr : mixed

SimpleRegister()

public SimpleRegister(mixed $USER_EMAIL[, mixed $SITE_ID = false ]) : mixed
Parameters
$USER_EMAIL : mixed
$SITE_ID : mixed = false

UnblockAgent()

public static UnblockAgent(mixed $userId) : mixed
Parameters
$userId : mixed

Update()

public Update(mixed $ID, mixed $arFields[, mixed $authActions = true ]) : mixed
Parameters
$ID : mixed
$arFields : mixed
$authActions : mixed = true

UpdateDigest()

public static UpdateDigest(mixed $ID, mixed $pass) : mixed
Parameters
$ID : mixed
$pass : mixed

UpdateSessionData()

public UpdateSessionData(Context $context[, mixed $onlyActive = true ]) : mixed
Parameters
$context : Context
$onlyActive : mixed = true

UserTypeRightsCheck()

public static UserTypeRightsCheck(mixed $entity_id) : mixed
Parameters
$entity_id : mixed

VerifyPhoneCode()

public static VerifyPhoneCode(string $phoneNumber, string $code) : bool|int
Parameters
$phoneNumber : string
$code : string
Return values
bool|int

User ID on success, false on error


        
On this page

Search results