Commit 4968d160 authored by Zohten's avatar Zohten

permission on getall

parent 35b8d31b
...@@ -54,6 +54,11 @@ class UserController extends Controller ...@@ -54,6 +54,11 @@ class UserController extends Controller
*/ */
protected function getAllUsers() protected function getAllUsers()
{ {
// Auth with token phase
$authResponse = $this->authUser(-1,'admin');
if($authResponse->getCode()!=200){
return $authResponse;
}
$users = User::getList(); $users = User::getList();
$response = Response::okResponse(json_encode($users, JSON_PRETTY_PRINT)); $response = Response::okResponse(json_encode($users, JSON_PRETTY_PRINT));
return $response; return $response;
......
### Récupérer tous les users ### Récupérer tous les users
GET http://localhost/index.php/user GET http://localhost/index.php/user
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDcwOTQyNjIsImV4cCI6MTYwNzA5Nzg2MiwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjciLCJyb2xlIjoiMiIsImVtYWlsIjoiYmVsb3ZlZC5hZG1pbkBmcmVlLmZyIn19.uQTflrpgfkiI3PS3PXHI2srBpNk8uqENHDHWX-48zGk
### Récupérer le user avec id 3 ### Récupérer le user avec id 3
GET http://localhost/index.php/user/3 GET http://localhost/index.php/user/3
......
...@@ -2,10 +2,16 @@ ...@@ -2,10 +2,16 @@
[Revenir en arrière](../BackSummary.md) [Revenir en arrière](../BackSummary.md)
|Méthode|Token|Endpoint |Description |Champs json| |Méthode|Token|Permission|Endpoint |Description |Champs json|
|-------|-----|--------------------|---------------------------------------|-----------| |-------|-----|----------|--------------------|---------------------------------------|-----------|
|GET | Oui |`/user` |Récupérer tous les users | | |GET | Non |A|`/user` |Récupérer tous les users | |
|GET | Oui |`/user/{id}` |Récupérer le user {id} | | |GET | Non | |`/user/{id}` |Récupérer le user {id} | |
|PUT | Oui |`/user/{id}` |Modifie le user {id} |`id`,`email`| |PUT | Oui |U|`/user/{id}` |Modifie le user {id} |`id`,`email`|
|POST | Non |`/user` |Enregistrement d'un user |`login`,`pwd`,`avatar`, `lastname`, `firstname`, `mail`| |POST | Non | |`/user` |Enregistrement d'un user |`login`,`pwd`,`avatar`, `lastname`, `firstname`, `mail`|
|DELETE | Oui |`/user/{id}` |Suppression du user {id} | | |DELETE | Oui |U|`/user/{id}` |Suppression du user {id} | |
Permissions:
- A = Admin seulement
- U = Admin ou utilisateur qui agit sur sa propre ressource
- V = N'importe qui avec un token valide
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment