Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
UserService.php
1<?php
2
4
8
10{
12 {
13 $currentUser = CurrentUser::get();
14
15 if (!$this->isAuthorised((int)$currentUser->getId()))
16 {
18 }
19
20 return GetCurrentUserResponse::createOk(['user' => $currentUser]);
21 }
22
23 public function isAuthorised(int $userId): bool
24 {
25 return $userId > 0;
26 }
27
28 public function isCurrentUserPortalAdmin(): bool
29 {
30 $result = $this->getCurrentUser();
31
32 return (
33 $result->isSuccess()
34 && (
35 $result->getUser()?->isAdmin()
36 || (
37 Loader::includeModule('bitrix24')
38 && \CBitrix24::IsPortalAdmin($result->getUser()?->getId())
39 )
40 )
41 );
42 }
43}
static createOk(?array $data=null)
Definition result.php:20