Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
user.php
1<?php
2
4
5class User extends BaseContext
6{
12 public function __construct($user)
13 {
14 $this->userId = static::resolveUserId($user);
15 $this->setUserGroups(\CUser::getUserGroup($this->userId));
16 }
17
24 private static function resolveUserId($user)
25 {
26 if ($user instanceof \CUser)
27 {
28 return (int)$user->getId();
29 }
30 elseif(is_numeric($user) && (int)$user > 0)
31 {
32 return (int)$user;
33 }
34
35 return static::GUEST_USER_ID;
36 }
37}