diff --git a/build/api/module/authenticationDefault.php b/build/api/module/authenticationDefault.php index 9b58064..c9d4435 100755 --- a/build/api/module/authenticationDefault.php +++ b/build/api/module/authenticationDefault.php @@ -122,7 +122,30 @@ + /* RETOURNE LA LISTE DSE ADMINISTRATEURS DE L'ENTREPOT + * + * @return admins Liste des administrateurs de l'entrepôt + * + */ + public function get_admins($params){ + /* (1) Fetch admin list + ---------------------------------------------------------*/ + /* (1) Prepare request */ + $listRq = new Repo('admin/getByIdWarehouse', [ $_SESSION['WAREHOUSE']['id'] ]); + /* (2) Get response */ + $listRs = $listRq->answer(); + + /* (3) Manage error */ + if( !is_array($listRs) ) + return ['error' => new Error(Err::RepoError)]; + + + /* (2) Setup data (remove self) + ---------------------------------------------------------*/ + return ['admins' => $listRs]; + + } diff --git a/config/modules.json b/config/modules.json index aa72320..d7f9f89 100755 --- a/config/modules.json +++ b/config/modules.json @@ -61,6 +61,15 @@ } }, + "POST::get_admins": { + "description": "Retourne la liste des administrateurs de l'entrepôt.", + "permissions": [["admin"]], + "parameters": {}, + "output": { + "admin": { "description": "Liste des administrateur.", "type": "array" } + } + }, + "POST::update_admin": { "description": "Changement de mot de passe administrateur", "permissions": [["admin"]], diff --git a/config/repositories.json b/config/repositories.json index 3a13be1..3b66f9d 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -160,6 +160,7 @@ "getAll", "getById", "getByUsername", + "getByIdWarehouse", "getByMail", "getByToken",