From 6d04f2a08ef66e421ec4d0b12bc81bdc58ba7ddb Mon Sep 17 00:00:00 2001 From: Pierre Cadeot Date: Thu, 11 Mar 2021 16:17:32 +0400 Subject: [PATCH] api edispatcher/api/applications (fixes #31889) --- .../Controller/ApiController.php | 33 +++++++++++++++++++ .../Resources/config/routing.yml | 4 +++ 2 files changed, 37 insertions(+) diff --git a/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Controller/ApiController.php b/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Controller/ApiController.php index 19e213d5..3758160f 100755 --- a/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Controller/ApiController.php +++ b/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Controller/ApiController.php @@ -39,6 +39,39 @@ use Cadoles\EdispatcherBundle\Entity\Datasource; class ApiController extends Controller { + + public function applicationsAction() { + $itemcategorys = $this->getDoctrine()->getRepository('CadolesPortalBundle:Itemcategory')->findBy( +[], ['rowOrder' => 'asc']); + $groups = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->findBy([], ['label' => +'asc']); + foreach($itemcategorys as $itemcategory) { + $items = $itemcategory->getItems(); + + foreach($items as $item) { + $output = []; + $output["id"] = $item->getId(); + $output["name"] = $item->getTitle(); + $output["libelle"] = $item->getSubtitle(); + $output["icon"] = $item->getIcon()?$item->getIcon()->getLabel():"default"; + $output["url"] = $item->getUrl(); + $output["profils"] = []; + + foreach($item->getGroups() as $group) { + $output["profils"]["groupes"][] = "NINEGATE|".$group->getLabel(); + } + foreach($item->getRoles() as $role) { + $output["profils"]["roles"][] = "NINEGATE|".$role; + } + if ($item->getSsoitem()!="") $output["profils"]["SSOITEM"] = $item->getSsoitem(); + $reponse[$item->getTitle()] = $output; + } + } + + return new Response(json_encode($reponse), Response::HTTP_OK); + } + + public function testAction() { $em = $this->getDoctrine()->getManager(); diff --git a/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Resources/config/routing.yml index 2461c1d0..99db81ab 100755 --- a/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/EdispatcherBundle/Resources/config/routing.yml @@ -25,6 +25,10 @@ cadoles_edispatcher_api_public_hello: path: /edispatcher/api/public/hello defaults: { _controller: CadolesEdispatcherBundle:Api:hello } +cadoles_edispatcher_api_applications: + path: /edispatcher/api/applications + defaults: { _controller: CadolesEdispatcherBundle:Api:applications } + cadoles_edispatcher_api_apps_all: path: /edispatcher/api/apps/all defaults: { _controller: CadolesEdispatcherBundle:Api:hello }