Gestion de l'appartenance d'un administrateur à un entrepot pour l'authentification (manager 'Authentification')
This commit is contained in:
parent
482f7888d2
commit
9210abcd64
|
@ -3,20 +3,20 @@
|
|||
"module": {
|
||||
"method": {
|
||||
"description": "Test de l'API",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {}
|
||||
},
|
||||
|
||||
"markdown": {
|
||||
"description": "Retourne une description en markdown des différents modules de l'API",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"options": { "download": true },
|
||||
"parameters": {}
|
||||
},
|
||||
|
||||
"apiBlueprint": {
|
||||
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"options": { "download": true },
|
||||
"parameters": {}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
"admin": {
|
||||
"description": "Connexion de second niveau : administrateur.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse"],
|
||||
"parameters": {
|
||||
"name": { "description": "Identifiant de l'administrateur.", "type": "varchar(1,30,alphanumeric)" },
|
||||
"password": { "description": "Mot de passe de l'administrateur'.", "type": "text" }
|
||||
|
@ -84,7 +84,7 @@
|
|||
|
||||
"create": {
|
||||
"description": "Création d'un nouvel utilisateur.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" },
|
||||
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" },
|
||||
|
@ -102,7 +102,7 @@
|
|||
|
||||
"link": {
|
||||
"description": "Ajout d'un utilisateur à un groupe.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_cluster": { "description": "UID du groupe auquel rattacher.", "type": "id" },
|
||||
"id_user": { "description": "UID de l'utilisateur à rattacher.", "type": "id" }
|
||||
|
@ -113,7 +113,7 @@
|
|||
|
||||
"unlink": {
|
||||
"description": "Retrait d'un utilisateur d'un groupe",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_cluster": { "description": "UID du groupe auquel détacher.", "type": "id" },
|
||||
"id_user": { "description": "UID de l'utilisateur à détacher.", "type": "id" }
|
||||
|
@ -123,7 +123,7 @@
|
|||
|
||||
"search": {
|
||||
"description": "Recherche d'un utilisateur par mots-clés.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"keywords": { "description": "Mots-clés de la recherche.", "type": "text" }
|
||||
},
|
||||
|
@ -134,7 +134,7 @@
|
|||
|
||||
"getAll": {
|
||||
"description": "Liste de tous les utilisateurs",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {},
|
||||
"output": {
|
||||
"users": { "description": "Liste de tous les utilisateurs.", "type": "array<array<mixed>>" }
|
||||
|
@ -154,7 +154,7 @@
|
|||
|
||||
"getByCode": {
|
||||
"description": "Retourne un utilisateur de Code RFID donné.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" }
|
||||
},
|
||||
|
@ -165,7 +165,7 @@
|
|||
|
||||
"getByUsername": {
|
||||
"description": "Retourne un utilisateur d'identifiant donné.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" }
|
||||
},
|
||||
|
@ -176,7 +176,7 @@
|
|||
|
||||
"getClusters": {
|
||||
"description": "Retourne les groupes d'un utilisateur.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_user": { "description": "UID de l'utilisateur.", "type": "id" }
|
||||
},
|
||||
|
@ -187,7 +187,7 @@
|
|||
|
||||
"edit": {
|
||||
"description": "Modifie les attributs d'un utilisateur.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_user": { "description": "UID de l'utilisateur.", "type": "id" },
|
||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid", "optional": true },
|
||||
|
@ -206,7 +206,7 @@
|
|||
|
||||
"delete": {
|
||||
"description": "Suppression d'un utilisateur.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_user": { "description": "UID de l'utilisateur.", "type": "id" }
|
||||
},
|
||||
|
@ -221,7 +221,7 @@
|
|||
"machineDefault": {
|
||||
"create": {
|
||||
"description": "Création d'une nouvelle machine.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"code": { "description": "Code RFID de la machine.", "type": "rfid" },
|
||||
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,alphanumeric)" }
|
||||
|
@ -234,7 +234,7 @@
|
|||
|
||||
"link": {
|
||||
"description": "Ajout d'une machine à un groupe.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" },
|
||||
"id_cluster": { "description": "UID du groupe de la machine.", "type": "id" }
|
||||
|
@ -244,7 +244,7 @@
|
|||
|
||||
"unlink": {
|
||||
"description": "Retrait d'une machine d'un groupe.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" },
|
||||
"id_cluster": { "description": "UID du groupe de la machine.", "type": "id" }
|
||||
|
@ -254,7 +254,7 @@
|
|||
|
||||
"search": {
|
||||
"description": "Recherche une machine par mots-clés.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"keywords": { "description": "Mots-clés de recherche de machine", "type": "text" }
|
||||
},
|
||||
|
@ -265,7 +265,7 @@
|
|||
|
||||
"getAll": {
|
||||
"description": "Retourne la liste de toutes les machines.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {},
|
||||
"output": {
|
||||
"machines": { "description": "Liste de toutes les machines.", "type": "array<array<mixed>>" }
|
||||
|
@ -274,7 +274,7 @@
|
|||
|
||||
"getById": {
|
||||
"description": "Retourne les données d'une machine.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" }
|
||||
},
|
||||
|
@ -285,7 +285,7 @@
|
|||
|
||||
"getByCode": {
|
||||
"description": "Retourne les données d'une machine de code RFID donné.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"code": { "description": "Code RFID de la machine.", "type": "rfid" }
|
||||
},
|
||||
|
@ -296,7 +296,7 @@
|
|||
|
||||
"getByName": {
|
||||
"description": "Retourne les données d'une machine de nom donné.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,alphanumeric)" }
|
||||
},
|
||||
|
@ -307,7 +307,7 @@
|
|||
|
||||
"getClusters": {
|
||||
"description": "Retourne les groupes d'une machine.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" }
|
||||
},
|
||||
|
@ -318,7 +318,7 @@
|
|||
|
||||
"edit": {
|
||||
"description": "Modifie les attributs d'une machine.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" },
|
||||
"code": { "description": "Code RFID de la machine.", "type": "rfid", "optional": true },
|
||||
|
@ -329,7 +329,7 @@
|
|||
|
||||
"delete": {
|
||||
"description": "Supprime une machine.",
|
||||
"permissions": [],
|
||||
"permissions": ["warehouse", "admin"],
|
||||
"parameters": {
|
||||
"id_machine": { "description": "UID de la machine.", "type": "id" }
|
||||
},
|
||||
|
|
|
@ -98,6 +98,10 @@
|
|||
if( count($checkBranch->answer()) < 1 )
|
||||
return false;
|
||||
|
||||
// Si pas administrateur de l'entrepot
|
||||
if( $checkBranch->answer()[0]['id_warehouse'] != $_SESSION['WAREHOUSE']['id'] )
|
||||
return false;
|
||||
|
||||
// On met à jour les informations
|
||||
$_SESSION['ADMIN'] = [
|
||||
'id' => $checkBranch->answer()[0]['id_admin'],
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace manager;
|
||||
|
||||
use \manager\Authentification;
|
||||
|
||||
|
||||
// FORMAT:
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue