29 if ($param->hasErrors())
37 $this->iBlockTypeId = (string)$paramValues[
'IBLOCK_TYPE_ID'];
38 if ((
int)$paramValues[
'IBLOCK_ID'] > 0)
40 $this->iBlockId = (int)$paramValues[
'IBLOCK_ID'];
42 if ((
int)$paramValues[
'SOCNET_GROUP_ID'] > 0)
44 $this->socNetGroupId = (int)$paramValues[
'SOCNET_GROUP_ID'];
51 $this->isCurrentUser =
true;
69 if ($this->userId === 0 || !$this->isCurrentUser)
71 return $response->addError(static::getNotSupportedUserIdError());
76 'IBLOCK_TYPE_ID' => $this->iBlockTypeId,
77 'IBLOCK_ID' => $this->iBlockId > 0 ? $this->iBlockId :
false,
78 'SOCNET_GROUP_ID' => $this->socNetGroupId,
81 $rightParam->setUser(
$USER);
86 ->setRightParam($rightParam)
87 ->setPermission(
$right->getPermission())
90 if (!
$right->checkPermission())
108 string $entityMethod =
null,
113 if ($this->userId === 0 || !$this->isCurrentUser)
115 return $response->addError(static::getNotSupportedUserIdError());
122 'IBLOCK_TYPE_ID' => $this->iBlockTypeId,
124 'SOCNET_GROUP_ID' => $this->socNetGroupId,
127 $rightParam->setUser(
$USER);
128 $rightParam->setEntityId($elementId);
129 $rightParam->setSectionId(max($sectionId, 0));
135 ->setRightParam($rightParam)
136 ->setElementRight($elementRight)
137 ->setPermission(
$right->getPermission())
140 if (!
$right->checkPermission($entityMethod ??
''))
156 if ($this->userId === 0 || !$this->isCurrentUser)
158 return $response->addError(static::getNotSupportedUserIdError());
165 'IBLOCK_TYPE_ID' => $this->iBlockTypeId,
167 'SOCNET_GROUP_ID' => $this->socNetGroupId,
170 $rightParam->setUser(
$USER);
176 ->setRightParam($rightParam)
177 ->setIBlockRight($iBlockRight)
178 ->setPermission(
$right->getPermission())
181 if (!
$right->checkPermission($entityMethod ??
''))
196 if ($this->userId === 0 || !$this->isCurrentUser)
198 return $response->addError(static::getNotSupportedUserIdError());
206 'IBLOCK_ID' =>
false,
207 'SOCNET_GROUP_ID' => $this->socNetGroupId,
210 $rightParam->setUser(
$USER);
215 ->setRightParam($rightParam)
216 ->setPermission(
$right->getPermission())
219 if (!
$right->checkPermission())
259 return new Error(Loc::getMessage(
'LISTS_LIB_API_ACCESS_SERVICE_ERROR_ACCESS_DENIED'));
267 return new Error(Loc::getMessage(
'LISTS_LIB_API_ACCESS_SERVICE_ERROR_NOT_SUPPORTED_USER_ID'));
static getAccessDeniedError()
isAdminPermission(string|int $permission)
static getNotSupportedUserIdError()
__construct(int $userId, Param $param)
isCanReadPermission(string|int $permission)
checkIBlockPermission(int $iBlockId=null, string $entityMethod=null)
isAccessDeniedPermission(string|int $permission)
checkIBlockTypePermission(string $iBlockTypeId=null)
checkElementPermission(int $elementId=0, int $sectionId=0, string $entityMethod=null, int $iBlockId=null,)
checkRequiredInputParams(array $requiredInputParams)