post api à la place de get api

This commit is contained in:
afornerot 2020-07-07 09:23:24 +02:00
parent 025009e76c
commit 8dec77a946
2 changed files with 15 additions and 8 deletions

View File

@ -29,8 +29,9 @@ use Cadoles\CoreBundle\Form\UserType;
class RestController extends Controller class RestController extends Controller
{ {
public function loginAction($key,Request $request) public function loginAction(Request $request)
{ {
$key=$request->get('key');
$output=[]; $output=[];
// Vérification de la clé // Vérification de la clé
@ -43,8 +44,10 @@ class RestController extends Controller
return new Response(json_encode($output), 200); return new Response(json_encode($output), 200);
} }
public function userAction($key, $login, Request $request) public function userAction($login, Request $request)
{ {
$key=$request->get('key');
// Vérification de la clé // Vérification de la clé
$realkey = $this->getParameter("apikeyninegate"); $realkey = $this->getParameter("apikeyninegate");
if($key!=$realkey) { if($key!=$realkey) {
@ -143,8 +146,10 @@ class RestController extends Controller
} }
public function usersAction($key, Request $request) public function usersAction(Request $request)
{ {
$key=$request->get('key');
// Vérification de la clé // Vérification de la clé
$realkey = $this->getParameter("apikeyninegate"); $realkey = $this->getParameter("apikeyninegate");
if($key!=$realkey) { if($key!=$realkey) {
@ -174,8 +179,10 @@ class RestController extends Controller
return new Response(json_encode($output), 200); return new Response(json_encode($output), 200);
} }
public function groupsAction($key, Request $request) public function groupsAction(Request $request)
{ {
$key=$request->get('key');
// Vérification de la clé // Vérification de la clé
$realkey = $this->getParameter("apikeyninegate"); $realkey = $this->getParameter("apikeyninegate");
if($key!=$realkey) { if($key!=$realkey) {

View File

@ -493,17 +493,17 @@ cadoles_core_config_statistic:
#== REST ================================================================================================================== #== REST ==================================================================================================================
cadoles_core_rest_login: cadoles_core_rest_login:
path: /rest/login/{key} path: /rest/login
defaults: { _controller: CadolesCoreBundle:Rest:login } defaults: { _controller: CadolesCoreBundle:Rest:login }
cadoles_core_rest_user: cadoles_core_rest_user:
path: /rest/user/{key}/{login} path: /rest/user/{login}
defaults: { _controller: CadolesCoreBundle:Rest:user } defaults: { _controller: CadolesCoreBundle:Rest:user }
cadoles_core_rest_users: cadoles_core_rest_users:
path: /rest/users/{key} path: /rest/users
defaults: { _controller: CadolesCoreBundle:Rest:users } defaults: { _controller: CadolesCoreBundle:Rest:users }
cadoles_core_rest_groups: cadoles_core_rest_groups:
path: /rest/groups/{key} path: /rest/groups
defaults: { _controller: CadolesCoreBundle:Rest:groups } defaults: { _controller: CadolesCoreBundle:Rest:groups }