- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/helper/workgroup.php
- Класс: BitrixSocialnetworkHelperWorkgroup
- Вызов: Workgroup::deleteOutgoingRequest
static function deleteOutgoingRequest(array $fields = []): bool
{
$groupId = (int)($fields['groupId'] ?? 0);
$userId = (int)($fields['userId'] ?? 0);
if ($groupId <= 0)
{
throw new ArgumentException(Loc::getMessage('SOCIALNETWORK_HELPER_WORKGROUP_ERROR_WRONG_GROUP_ID'));
}
if ($userId <= 0)
{
throw new ArgumentException(Loc::getMessage('SOCIALNETWORK_HELPER_WORKGROUP_ERROR_WRONG_USER_ID'));
}
try
{
$relation = static::getRelation([
'=GROUP_ID' => $groupId,
'=USER_ID' => $userId,
]);
}
catch (Exception $e)
{
throw new Exception($e->getMessage(), $e->getCode());
}
if (!HelperWorkgroupAccess::canDeleteOutgoingRequest([
'userId' => $userId,
'groupId' => $groupId,
]))
{
throw new AccessDeniedException(Loc::getMessage('SOCIALNETWORK_HELPER_WORKGROUP_ERROR_OPERATION_NO_PERMS'));
}
try
{
self::deleteRelation([
'relationId' => $relation->getId(),
]);
}
catch (Exception $e)
{
throw new Exception($e->getMessage(), $e->getCode());
}
return true;
}