1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UserService.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Api\Service;
4
5use Bitrix\Bizproc\Api\Data\UserService\UsersToGet;
6use Bitrix\Bizproc\Api\Response\UserService\GetCurrentUserResponse;
7use Bitrix\Bizproc\Api\Response\UserService\GetUsersViewResponse;
8use Bitrix\Bizproc\UI\UserView;
9use Bitrix\Main\Engine\CurrentUser;
10use Bitrix\Main\Loader;
11use Bitrix\Main\UserTable;
12
14{
16 {
17 $currentUserResponse = $this->getCurrentUser();
18 if (!$currentUserResponse->isSuccess())
19 {
21 $response->addErrors($currentUserResponse->getErrors());
22
23 return $response;
24 }
25
26 $ids = $request->getUserIds();
27
28 if (!$ids)
29 {
30 return new GetUsersViewResponse();
31 }
32
33 $userIterator = UserTable::query()
34 ->setSelect(['ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'PERSONAL_PHOTO', 'WORK_POSITION'])
35 ->setFilter(['ID' => $ids])
36 ->exec()
37 ;
38
40 while ($user = $userIterator->fetchObject())
41 {
42 $response->addUserView(new UserView($user));
43 }
44
45 return $response;
46 }
47
49 {
50 $currentUser = CurrentUser::get();
51
52 if (!$this->isAuthorised((int)$currentUser->getId()))
53 {
55 }
56
57 return GetCurrentUserResponse::createOk(['user' => $currentUser]);
58 }
59
60 public function isAuthorised(int $userId): bool
61 {
62 return $userId > 0;
63 }
64
65 public function isCurrentUserPortalAdmin(): bool
66 {
67 $result = $this->getCurrentUser();
68
69 return (
70 $result->isSuccess()
71 && (
72 $result->getUser()?->isAdmin()
73 || (
74 Loader::includeModule('bitrix24')
75 && \CBitrix24::IsPortalAdmin($result->getUser()?->getId())
76 )
77 )
78 );
79 }
80}
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
getUsersView(UsersToGet $request)
Определения UserService.php:15
isAuthorised(int $userId)
Определения UserService.php:60
$result
Определения get_property_values.php:14
$user
Определения mysql_to_pgsql.php:33
$response
Определения result.php:21