12use Bitrix\Socialnetwork\EO_UserToGroup;
13use Bitrix\Socialnetwork\EO_Workgroup;
14use Bitrix\Socialnetwork\EO_WorkgroupFavorites;
30 ?array $additionalEntityList = [],
31 ?array $additionalParams = []
37 $this->isCurrentUserModuleAdmin = self::isCurrentUserModuleAdmin((
bool)($additionalParams[
'checkAdminSession'] ??
true));
38 $this->currentUserId = \Bitrix\Socialnetwork\Helper\User::getCurrentUserId();
39 if (is_array($additionalEntityList) && !empty($additionalEntityList))
42 $additionalEntityList[
'currentUserFavorites']
43 && get_class($additionalEntityList[
'currentUserFavorites']) === EO_WorkgroupFavorites::class
46 $this->currentUserFavorites = $additionalEntityList[
'currentUserFavorites'];
51 private static function isCurrentUserModuleAdmin(
bool $checkSession =
false): bool
57 $cacheKey = ($checkSession ?
'Y' :
'N');
59 if ($result[$cacheKey] ===
null)
61 $result[$cacheKey] = \CSocNetUser::isCurrentUserModuleAdmin(SITE_ID, $checkSession);
64 return $result[$cacheKey];
80 $this->isCurrentUserModuleAdmin
81 || $this->group->get(
'VISIBLE')
83 $this->currentUserRelation
105 !$this->isCurrentUserModuleAdmin
137 return !$this->group->get(
'CLOSED');
147 return $this->group->get(
'CLOSED');
157 return ($this->currentUserFavorites ===
null);
167 return ($this->currentUserFavorites !==
null);
183 $this->targetUserRelation
186 || !in_array($this->targetUserRelation->get(
'ROLE'), [
197 !$this->isCurrentUserModuleAdmin
230 $this->targetUserRelation
241 !$this->isCurrentUserModuleAdmin
264 !$this->targetUserRelation
273 !$this->isCurrentUserModuleAdmin
297 !$this->targetUserRelation
300 || $this->targetUserRelation->get(
'USER_ID') === $this->currentUserId
312 !$this->isCurrentUserModuleAdmin
336 !$this->isCurrentUserModuleAdmin
337 && !$this->group->get(
'VISIBLE')
344 $this->currentUserRelation
355 !$this->isCurrentUserModuleAdmin
380 !$this->currentUserRelation
387 if (!in_array($this->currentUserRelation->get(
'ROLE'), [
395 if ($this->currentUserRelation->get(
'AUTO_MEMBER'))
426 'INITIATED_BY_USER_ID',
430 !$this->isCurrentUserModuleAdmin
438 !$this->targetUserRelation
455 && (
int)$this->targetUserRelation->get(
'INITIATED_BY_USER_ID') !== $this->currentUserId
484 !$this->isCurrentUserModuleAdmin
497 !$this->targetUserRelation
499 || $this->targetUserRelation->get(
'AUTO_MEMBER')
500 || $this->targetUserRelation->get(
'USER_ID') === $this->currentUserId
501 || !in_array($this->targetUserRelation->get(
'ROLE'), [
516 !$this->isCurrentUserModuleAdmin
547 !$this->isCurrentUserModuleAdmin
555 !$this->targetUserRelation
587 'INITIATED_BY_USER_ID',
591 !$this->isCurrentUserModuleAdmin
599 !$this->targetUserRelation
616 !$this->isCurrentUserModuleAdmin
617 && (
int)$this->targetUserRelation->get(
'INITIATED_BY_USER_ID') !== $this->currentUserId
648 if (!$favoritesEntity)
658 foreach ($fieldsList as $field)
660 if (!$entityObject->has($field))
668 ?EO_UserToGroup $relation
673 && (
int)$this->group->get(
'ID') === (
int)$relation->get(
'GROUP_ID')
678 ?EO_WorkgroupFavorites $favoritesEntity
683 && (
int)$this->group->get(
'ID') === (
int)$favoritesEntity->get(
'GROUP_ID')
688 ?EO_UserToGroup $relation
701 EO_UserToGroup $relation
708 ?EO_UserToGroup $relation
712 $this->group->get(
'PROJECT')
714 && (
int)$this->group->get(
'SCRUM_MASTER_ID') === (
int)$relation->get(
'USER_ID')
721 $this->group->get(
'PROJECT')
722 && (
int)$this->group->get(
'SCRUM_MASTER_ID') > 0
729 !$this->group->get(
'CLOSED')
730 || \
Bitrix\Socialnetwork\Item\Workgroup::canWorkWithClosedWorkgroups()
737 $this->isCurrentUserModuleAdmin
745 $this->isCurrentUserModuleAdmin
752 && in_array($this->currentUserRelation->get(
'ROLE'), [
761 || $this->checkScrumMaster($this->currentUserRelation)
770 $this->currentUserRelation
771 && in_array($this->currentUserRelation->get(
'ROLE'), [
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()