Commit cfa1a053 authored by Zohten's avatar Zohten

added comments

parent 2f87aafb
......@@ -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']) {
......
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