diff --git a/rest/index.php b/rest/index.php index b4ca97ca3286700851dc7a1db7aa7de164f8f1bf..2ab3fdbff25d06d34ca89a5f9533245926b1dea8 100755 --- a/rest/index.php +++ b/rest/index.php @@ -109,7 +109,6 @@ $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/core/controllers/CoreController.php b/src/core/controllers/CoreController.php index 9226c3a582c4ec8e57b7c61ffb4258acd55040c5..be3df2c4c14cfe3ca5e505bb33aa384390e68585 100644 --- a/src/core/controllers/CoreController.php +++ b/src/core/controllers/CoreController.php @@ -29,6 +29,8 @@ class CoreController $aInit['coreUrl'] = str_replace('rest/', '', \Url::coreurl()); $aInit['applicationName'] = CoreConfigModel::getApplicationName(); $aInit['lang'] = CoreConfigModel::getLanguage(); + $aInit['user'] = UserModel::getByUserId(['userId' => $GLOBALS['userId'], 'select' => ['id', 'user_id', 'firstname', 'lastname']]); + $aInit['user']['groups'] = UserModel::getGroupsByUserId(['userId' => $GLOBALS['userId']]); $aInit['scriptsToinject'] = []; $scriptsToInject = scandir('dist'); @@ -49,14 +51,6 @@ 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') {