18 lines
805 B
PHP
Executable File
18 lines
805 B
PHP
Executable File
<?php
|
|
namespace Conmed\Authserver;
|
|
|
|
use Bitrix\Main\Config\Option;
|
|
use Bitrix\Main\Context;
|
|
use Bitrix\Main\Type\DateTime;
|
|
use Bitrix\Highloadblock\HighloadBlockTable;
|
|
use Bitrix\Main\Loader;
|
|
|
|
trait GroupsTrait {
|
|
public static function groupsAction() {
|
|
header('Content-Type: application/json'); $req = Context::getCurrent()->getRequest();
|
|
if(!self::checkClient($req->get("client_id"), $req->get("client_secret"))) die(json_encode(['error'=>'forbidden']));
|
|
$rs = \Bitrix\Main\GroupTable::getList(['filter'=>['=ACTIVE'=>'Y','=C_SORT'=>555],'select'=>['ID','NAME','STRING_ID'],'order'=>['NAME'=>'ASC']]);
|
|
$res = []; while($g = $rs->fetch()) if($g['STRING_ID']) $res[] = ['id'=>$g['ID'], 'name'=>$g['NAME'], 'code'=>$g['STRING_ID']];
|
|
echo json_encode($res);
|
|
}
|
|
} |