Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
4968d160
Commit
4968d160
authored
Dec 04, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
permission on getall
parent
35b8d31b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
UserController.class.php
BackEnd/src/controller/UserController.class.php
+5
-0
userRequests.http
BackEnd/src/testRequests/userRequests.http
+1
-0
user.md
doc/backend/user.md
+13
-7
No files found.
BackEnd/src/controller/UserController.class.php
View file @
4968d160
...
@@ -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
;
...
...
BackEnd/src/testRequests/userRequests.http
View file @
4968d160
### 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
...
...
doc/backend/user.md
View file @
4968d160
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment