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
cfa1a053
Commit
cfa1a053
authored
Nov 24, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments
parent
2f87aafb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
UserController.class.php
BackEnd/src/controller/UserController.class.php
+21
-6
No files found.
BackEnd/src/controller/UserController.class.php
View file @
cfa1a053
...
...
@@ -12,10 +12,11 @@ class UserController extends Controller
parent
::
__construct
(
$name
,
$request
);
}
// ==============
// Actions
// ==============
/**
* Process incoming request for the /user endpoint
*
* @return Response
*/
public
function
processRequest
()
{
switch
(
$this
->
request
->
getHttpMethod
())
{
...
...
@@ -35,6 +36,11 @@ class UserController extends Controller
return
Response
::
errorResponse
(
"unsupported parameters or method in users"
);
}
/**
* Get all users in USER table
*
* @return Response
*/
protected
function
getAllUsers
()
{
$users
=
User
::
getList
();
...
...
@@ -44,18 +50,27 @@ class UserController extends Controller
return
$response
;
}
/**
* Get a specific user in USER table based on id
*
* @return Response
*/
protected
function
getUser
(
$id
)
{
$user
=
User
::
getRow
(
$id
);
$response
=
Response
::
okResponse
(
json_encode
(
$user
));
return
$response
;
}
/**
* Update a specific user in USER table based on id
*
* @return Response
*/
protected
function
updateUser
(
$array
)
{
try
{
//var_dump($array);die;
$jwt_token
=
$this
->
request
->
getJwtToken
();
// echo "jwt = $jwt_token";
$decodedJWT
=
JWT
::
decode
(
$jwt_token
,
JWT_BACKEND_KEY
,
array
(
'HS256'
));
if
(
$decodedJWT
->
data
->
id
!=
$array
[
'id'
])
{
...
...
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