Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
extranetusertrait.php
1<?php
2
4
11
12trait ExtranetUserTrait
13{
14 private function canSeeOwnerIfExtranetUser(SectionModel $sectionModel, AccessibleUser $userModel): bool
15 {
16 $result = true;
17 if ($userModel->isExtranetUser() && Loader::includeModule('socialnetwork'))
18 {
19 if (
20 $sectionModel->getType() === Dictionary::CALENDAR_TYPE['user']
21 && $sectionModel->getOwnerId() !== $userModel->getUserId()
22 )
23 {
24 $result = false;
25 }
26 elseif ($sectionModel->getType() === Dictionary::CALENDAR_TYPE['group'])
27 {
28 $userRole = \CSocNetUserToGroup::GetUserRole($userModel->getUserId(), $sectionModel->getOwnerId());
29
30 $result = $userRole && in_array($userRole, UserToGroupTable::getRolesMember(), true);
31 }
32 elseif($sectionModel->getType() === Dictionary::CALENDAR_TYPE['company'])
33 {
34 $result = false;
35 }
36 }
37
38 return $result;
39 }
40}