diff --git a/rest/index.php b/rest/index.php index 2ab3fdbff25d06d34ca89a5f9533245926b1dea8..b4ca97ca3286700851dc7a1db7aa7de164f8f1bf 100755 --- a/rest/index.php +++ b/rest/index.php @@ -109,6 +109,7 @@ $app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]); //Initialize $app->get('/initialize', \SrcCore\controllers\CoreController::class . ':initialize'); +$app->get('/headerInformations', \SrcCore\controllers\CoreController::class . ':getHeaderInformations'); //Actions $app->get('/actions', \Action\controllers\ActionController::class . ':get'); diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index b5205479c93147aa0485874a77afdbccb238e25b..4de168942386a4c43f5183e252bae35239435bb9 100644 --- a/src/app/user/controllers/UserController.php +++ b/src/app/user/controllers/UserController.php @@ -22,10 +22,7 @@ use Entity\models\ListTemplateModel; use Group\models\GroupModel; use History\controllers\HistoryController; use History\models\HistoryModel; -use Notification\controllers\NotificationController; use Notification\controllers\NotificationsEventsController; -use Notification\models\NotificationModel; -use Notification\models\NotificationsEventsModel; use Parameter\models\ParameterModel; use Respect\Validation\Validator; use Slim\Http\Request; diff --git a/src/core/controllers/CoreController.php b/src/core/controllers/CoreController.php index 91ae96b27c920022905822ebcb69628edd44acb2..9226c3a582c4ec8e57b7c61ffb4258acd55040c5 100644 --- a/src/core/controllers/CoreController.php +++ b/src/core/controllers/CoreController.php @@ -19,6 +19,7 @@ use Group\models\ServiceModel; use Slim\Http\Request; use Slim\Http\Response; use SrcCore\models\CoreConfigModel; +use User\models\UserModel; class CoreController { @@ -48,6 +49,14 @@ class CoreController return $response->withJson($aInit); } + public static function getHeaderInformations(Request $request, Response $response) + { + $user = UserModel::getByUserId(['userId' => $GLOBALS['userId'], 'select' => ['id', 'user_id', 'firstname', 'lastname']]); + $user['groups'] = UserModel::getGroupsByUserId(['userId' => $user['user_id']]); + + return $response->withJson($user); + } + public static function getAdministration(Request $request, Response $response) { if ($GLOBALS['userId'] == 'superadmin') {