• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/item/workgroup/accessmanager.php
  • Класс: BitrixSocialnetworkItemWorkgroupAccessManager
  • Вызов: AccessManager::canExclude
public function canExclude(): bool
{
	$this->checkGroupEntityFields([
		'ID',
		'CLOSED',
		'PROJECT',
		'SCRUM_MASTER_ID',
	]);
	$this->checkRelationEntityFields($this->currentUserRelation, [
		'GROUP_ID',
		'USER_ID',
		'ROLE',
	]);
	$this->checkRelationEntityFields($this->targetUserRelation, [
		'GROUP_ID',
		'ROLE',
		'AUTO_MEMBER',
	]);

	if (
		!$this->isCurrentUserModuleAdmin
		&& !$this->checkRelationGroupId($this->currentUserRelation)
	)
	{
		return false;
	}

	if (!$this->canCurrentUserModify())
	{
		return false;
	}

	if (
		!$this->targetUserRelation
		|| !$this->checkRelationGroupId($this->targetUserRelation)
		|| $this->targetUserRelation->get('AUTO_MEMBER')
		|| $this->targetUserRelation->get('USER_ID') === $this->currentUserId
		|| !in_array($this->targetUserRelation->get('ROLE'), [
			UserToGroupTable::ROLE_MODERATOR,
			UserToGroupTable::ROLE_USER,
		], true)
	)
	{
		return false;
	}

	if ($this->checkScrumMaster($this->targetUserRelation))
	{
		return false;
	}

	if (
		!$this->isCurrentUserModuleAdmin
		&& !$this->checkClosedGroup()
	)
	{
		return false;
	}

	return true;
}