- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/lib/engine/access/holdentity.php
- Класс: BitrixRestEngineAccessHoldEntity
- Вызов: HoldEntity::getUrl
static function getUrl(string $type, string $code) : string
{
$url = '';
$filter = [];
if ($type === static::TYPE_APP)
{
$app = AppTable::getByClientId($code);
if ($app)
{
if ($app['STATUS'] !== AppTable::STATUS_LOCAL)
{
$url = BitrixRestMarketplaceUrl::getApplicationDetailUrl($app['CODE']);
}
else
{
$filter['=APP_ID'] = $app['ID'];
}
}
}
elseif ($type === static::TYPE_WEBHOOK)
{
$res = PasswordTable::getList(
[
'filter' => [
'=PASSWORD' => $code,
],
'select' => [
'ID',
],
'limit' => 1,
]
);
if ($password = $res->fetch())
{
$filter['=PASSWORD_ID'] = $password['ID'];
}
}
if (!empty($filter))
{
$res = IntegrationTable::getList(
[
'filter' => $filter,
'select' => [
'ID',
'ELEMENT_CODE',
],
'limit' => 1,
]
);
if ($item = $res->fetch())
{
$url = BitrixRestUrlDevOps::getInstance()->getIntegrationEditUrl($item['ID'], $item['ELEMENT_CODE']);
}
}
return $url;
}