Initial commit: Auth Server Base
This commit is contained in:
18
local/modules/conmed.authserver/lib/.groupstrait.php.bak
Normal file
18
local/modules/conmed.authserver/lib/.groupstrait.php.bak
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user