14use Bitrix\Socialnetwork\EO_UserToGroup;
34 ?
array $additionalEntityList = [],
35 ?
array $additionalParams = []
42 if (isset($additionalParams[
'userId']))
44 $this->currentUserId = (int)$additionalParams[
'userId'];
45 $this->isCurrentUserModuleAdmin = \CSocNetUser::IsUserModuleAdmin($this->currentUserId);
50 $this->isCurrentUserModuleAdmin = self::isCurrentUserModuleAdmin((
bool)($additionalParams[
'checkAdminSession'] ??
true));
54 $this->user = UserModel::createFromId($this->currentUserId);
56 if (is_array($additionalEntityList) && !empty($additionalEntityList))
59 $additionalEntityList[
'currentUserFavorites']
60 && get_class($additionalEntityList[
'currentUserFavorites']) === EO_WorkgroupFavorites::class
63 $this->currentUserFavorites = $additionalEntityList[
'currentUserFavorites'];
68 private static function isCurrentUserModuleAdmin(
bool $checkSession =
false): bool
74 $cacheKey = ($checkSession ?
'Y' :
'N');
76 if (
$result[$cacheKey] ===
null)
78 $result[$cacheKey] = \CSocNetUser::isCurrentUserModuleAdmin(
SITE_ID, $checkSession);
96 static $visibilityCache = [];
98 $groupId = $this->group->getId();
100 if (!isset($visibilityCache[$groupId]))
102 $isVisible = $this->group->get(
'VISIBLE');
103 if (!$this->isExtranetGroup($groupId))
105 $isVisible = ($isVisible && !$this->user->isExtranet());
107 $visibilityCache[$groupId] = $isVisible;
111 $isVisible = $visibilityCache[$groupId];
115 $this->isCurrentUserModuleAdmin
118 $this->currentUserRelation
120 $this->currentUserRelation->get(
'ROLE'),
144 !$this->isCurrentUserModuleAdmin
176 return !$this->group->get(
'CLOSED');
186 return $this->group->get(
'CLOSED');
196 return ($this->currentUserFavorites ===
null);
206 return ($this->currentUserFavorites !==
null);
222 $this->targetUserRelation
225 || !in_array($this->targetUserRelation->get(
'ROLE'), [
236 !$this->isCurrentUserModuleAdmin
269 $this->targetUserRelation
280 !$this->isCurrentUserModuleAdmin
303 !$this->targetUserRelation
312 !$this->isCurrentUserModuleAdmin
336 !$this->targetUserRelation
339 || $this->targetUserRelation->get(
'USER_ID') === $this->currentUserId
351 !$this->isCurrentUserModuleAdmin
375 !$this->isCurrentUserModuleAdmin
376 && !$this->group->get(
'VISIBLE')
383 $this->currentUserRelation
394 !$this->isCurrentUserModuleAdmin
419 !$this->currentUserRelation
426 if (!in_array($this->currentUserRelation->get(
'ROLE'), [
434 if ($this->currentUserRelation->get(
'AUTO_MEMBER'))
465 'INITIATED_BY_USER_ID',
469 !$this->isCurrentUserModuleAdmin
477 !$this->targetUserRelation
494 && (
int)$this->targetUserRelation->get(
'INITIATED_BY_USER_ID') !== $this->currentUserId
523 !$this->isCurrentUserModuleAdmin
536 !$this->targetUserRelation
538 || $this->targetUserRelation->get(
'AUTO_MEMBER')
539 || $this->targetUserRelation->get(
'USER_ID') === $this->currentUserId
540 || !in_array($this->targetUserRelation->get(
'ROLE'), [
555 !$this->isCurrentUserModuleAdmin
586 !$this->isCurrentUserModuleAdmin
594 !$this->targetUserRelation
626 'INITIATED_BY_USER_ID',
630 !$this->isCurrentUserModuleAdmin
638 !$this->targetUserRelation
655 !$this->isCurrentUserModuleAdmin
656 && (
int)$this->targetUserRelation->get(
'INITIATED_BY_USER_ID') !== $this->currentUserId
668 ConverterFeature::isOn()
669 && $this->currentUserRelation
670 && $this->group->getType() === Type::Group->value
671 && $this->
checkOwner($this->currentUserRelation)
697 if (!$favoritesEntity)
707 foreach ($fieldsList as $field)
709 if (!$entityObject->has($field))
717 ?EO_UserToGroup $relation
722 && (
int)$this->group->get(
'ID') === (
int)$relation->get(
'GROUP_ID')
732 && (
int)$this->group->get(
'ID') === (
int)$favoritesEntity->get(
'GROUP_ID')
737 ?EO_UserToGroup $relation
750 EO_UserToGroup $relation
757 ?EO_UserToGroup $relation
761 $this->group->get(
'PROJECT')
763 && (
int)$this->group->get(
'SCRUM_MASTER_ID') === (
int)$relation->get(
'USER_ID')
770 $this->group->get(
'PROJECT')
771 && (
int)$this->group->get(
'SCRUM_MASTER_ID') > 0
778 !$this->group->get(
'CLOSED')
786 $this->isCurrentUserModuleAdmin
794 $this->isCurrentUserModuleAdmin
801 && in_array($this->currentUserRelation->get(
'ROLE'), [
810 || $this->checkScrumMaster($this->currentUserRelation)
819 $this->currentUserRelation
820 && in_array($this->currentUserRelation->get(
'ROLE'), [
828 private function isExtranetGroup(
int $groupId): bool
830 if (!Loader::includeModule(
'extranet'))
835 return \CExtranet::IsExtranetSocNetGroup($groupId);
static getCurrentUserId()
checkScrumMaster(?EO_UserToGroup $relation)
canDeleteOutgoingRequest()
checkEntityFields(\Bitrix\Main\ORM\Objectify\EntityObject $entityObject, array $fieldsList=[])
bool $isCurrentUserModuleAdmin
checkFavoritesEntityGroupId(?EO_WorkgroupFavorites $favoritesEntity)
checkOwner(EO_UserToGroup $relation)
checkOwnerOrScrumMaster(?EO_UserToGroup $relation)
canProcessIncomingRequest()
EO_WorkgroupFavorites $currentUserFavorites
EO_UserToGroup $targetUserRelation
__construct(EO_Workgroup $group, ?EO_UserToGroup $targetUserRelation, ?EO_UserToGroup $currentUserRelation, ?array $additionalEntityList=[], ?array $additionalParams=[])
canDeleteIncomingRequest()
checkRelationGroupId(?EO_UserToGroup $relation)
checkFavoritesEntityFields(?EO_WorkgroupFavorites $favoritesEntity, array $fieldsList=[])
checkGroupEntityFields(array $fieldsList=[])
EO_UserToGroup $currentUserRelation
checkRelationEntityFields(?EO_UserToGroup $relation, array $fieldsList=[])
canCurrentProcessRequestsIn()
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)