3declare(strict_types=1);
5namespace Bitrix\Socialnetwork\Permission;
7use Bitrix\Socialnetwork\Integration\Intranet\User;
8use Bitrix\Socialnetwork\UserToGroupTable;
9use Bitrix\Socialnetwork\WorkgroupTable;
12use CSocNetFeaturesPerms;
26 foreach ($users as
$user)
50 $permissions = $this->getPermissions($groupId,
$type, $feature, $operation);
52 if ($permissions ===
false)
62 $group = $this->getGroup($groupId);
68 if ($this->isClosedGroup($group, $feature, $operation))
70 if (!$this->isWorkWithClosedGroupEnabled())
85 if (!$this->isHiddenGroup($group))
100 return $this->checkIsEmployee(
$userId, $role);
110 return $this->checkIsModerator($role);
115 return $this->checkIsMember($role);
126 private function getGroup(
int $groupId):
array
128 $group = WorkgroupTable::getList([
129 'select' => [
'CLOSED',
'VISIBLE'],
130 'filter' => [
'ID' => $groupId],
141 private function isClosedGroup(
array $group,
string $feature,
string $operation): bool
143 $featureSettings = CSocNetAllowed::GetAllowedFeatures();
145 return $group[
"CLOSED"] ===
"Y"
146 && !in_array($operation, $featureSettings[$feature][
"minoperation"],
true);
149 private function isHiddenGroup(
array $group): bool
151 return $group[
"VISIBLE"] ===
"N";
154 private function isWorkWithClosedGroupEnabled(): bool
159 private function checkIsEmployee(
int $userId,
bool|
string $role): bool
165 private function checkIsModerator(
string $role): bool
170 private function checkIsMember(
string $role): bool
175 private function getPermissions(
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
canPerform(int $groupId, int $userId, bool|string $role, string $type, string $feature, string $operation, bool $isAdmin=false)
filterUsersWithAccess(int $groupId, array $users, string $type, string $feature, string $operation, bool $isAdmin=false)
static GetOptionString($module_id, $name, $def="", $site=false, $bExactSite=false)
static GetOperationPerm($type, $id, $feature, $operation)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const SONET_ROLES_EMPLOYEE
const SONET_ROLES_AUTHORIZED
const SONET_ROLES_MODERATOR