- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/internals/registry/featurepermregistry.php
- Класс: BitrixSocialnetworkInternalsRegistryFeaturePermRegistry
- Вызов: FeaturePermRegistry::load
public function load(array $entityIdList, string $feature, string $operation, int $userId = 0, string $entityType = SONET_ENTITY_GROUP): self
{
if (
empty($entityIdList)
|| empty($feature)
|| empty($operation)
|| !in_array($entityType, [ SONET_ENTITY_GROUP, SONET_ENTITY_USER ], true)
)
{
return $this;
}
$storageKey = $this->getStorageKey($userId, $entityType, $feature, $operation);
if (!isset($this->storage[$storageKey]))
{
$this->storage[$storageKey] = [];
}
$entityIdList = array_diff(array_unique($entityIdList), array_keys($this->storage[$storageKey]));
if (empty($entityIdList))
{
return $this;
}
$permissionData = CSocNetFeaturesPerms::canPerformOperation($userId, $entityType, $entityIdList, $feature, $operation);
if (!is_array($permissionData))
{
return $this;
}
foreach ($entityIdList as $id)
{
$this->storage[$storageKey][$id] = false;
}
foreach ($permissionData as $id => $hasAccess)
{
$this->storage[$storageKey][$id] = $hasAccess;
}
return $this;
}