diff --git a/app/Config/Acl.php b/app/Config/Acl.php index 67edbd35..54c64819 100644 --- a/app/Config/Acl.php +++ b/app/Config/Acl.php @@ -43,6 +43,7 @@ class Acl '#^/expense#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, STAFF_ROLE_ID]], '#^/sendDataToTPA#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]], '#^/swagger#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]], + '#^/viewClaimFile#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID, STAFF_ROLE_ID]], diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 42aab688..6dbc418a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -673,6 +673,9 @@ $routes->group("employeeRest", ['filter' => ['ratelimit' , 'appSignature'] ], fu $routes->post("getVerifiedRetailUserData", "RestAuthenticationController::getVerifiedRetailUserData"); $routes->post("updateRetailUserAuthDetails", "RestAuthenticationController::updateRetailUserAuthDetails"); + //samulss oauth login api's + $routes->get("getTokenforSamulssOAuthLogin", "RestAuthenticationController::getTokenforSamulssOAuthLogin"); + }); $routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'ratelimit' , 'appSignature', 'authJWT']], function ($routes) { @@ -1121,3 +1124,6 @@ $routes->group('expense', ["filter" => "authMVC", 'namespace' => 'App\Controller }); + + + diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index ae85137b..5ef73c7b 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -2425,4 +2425,25 @@ class RestAuthenticationController extends AdminController return; } + + public function getTokenforSamulssOAuthLogin() + { + $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getTokenforSamulssOAuthLogin: Function called"); + $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getTokenforSamulssOAuthLogin: Received payload = " . json_encode($this->request->getJSON() ?? [])); + + $id = $this->request->getGet('id') ?? null; + if(!$id){ + return $this->respond(['status' => 'failed','code' => 400,'message' => 'ID is required'], 200); + } + + $user = $this->employeeModel->where('id', $id)->first(); + if(!$user){ + return $this->respond(['status' => 'failed','code' => 400,'message' => 'User not found'], 200); + } + + $token = JWTToken::encode($user); + return $this->respond(['status' => 'success','code' => 200,'data' => $token], 200); + + } + } \ No newline at end of file