Skip to content
Snippets Groups Projects
Verified Commit 70c3d61e authored by Damien's avatar Damien
Browse files

FEAT #257 Get informations in global

parent 4dfc7ff9
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,6 @@ $app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]); ...@@ -109,7 +109,6 @@ $app = new \Slim\App(['settings' => ['displayErrorDetails' => true]]);
//Initialize //Initialize
$app->get('/initialize', \SrcCore\controllers\CoreController::class . ':initialize'); $app->get('/initialize', \SrcCore\controllers\CoreController::class . ':initialize');
$app->get('/headerInformations', \SrcCore\controllers\CoreController::class . ':getHeaderInformations');
//Actions //Actions
$app->get('/actions', \Action\controllers\ActionController::class . ':get'); $app->get('/actions', \Action\controllers\ActionController::class . ':get');
......
...@@ -29,6 +29,8 @@ class CoreController ...@@ -29,6 +29,8 @@ class CoreController
$aInit['coreUrl'] = str_replace('rest/', '', \Url::coreurl()); $aInit['coreUrl'] = str_replace('rest/', '', \Url::coreurl());
$aInit['applicationName'] = CoreConfigModel::getApplicationName(); $aInit['applicationName'] = CoreConfigModel::getApplicationName();
$aInit['lang'] = CoreConfigModel::getLanguage(); $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'] = []; $aInit['scriptsToinject'] = [];
$scriptsToInject = scandir('dist'); $scriptsToInject = scandir('dist');
...@@ -49,14 +51,6 @@ class CoreController ...@@ -49,14 +51,6 @@ class CoreController
return $response->withJson($aInit); 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) public static function getAdministration(Request $request, Response $response)
{ {
if ($GLOBALS['userId'] == 'superadmin') { if ($GLOBALS['userId'] == 'superadmin') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment