From baaac051af5ea27f375f4b4ac7842c05d1afc0b6 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Tue, 5 Nov 2019 11:08:02 +0100 Subject: [PATCH] FEAT #12003 TIME 0:10 removed shortcuts + administration routes --- rest/index.php | 4 -- src/core/controllers/CoreController.php | 50 ------------------------- 2 files changed, 54 deletions(-) diff --git a/rest/index.php b/rest/index.php index 23194a8459c..73852a21f63 100755 --- a/rest/index.php +++ b/rest/index.php @@ -64,9 +64,6 @@ $app->post('/actions', \Action\controllers\ActionController::class . ':create'); $app->put('/actions/{id}', \Action\controllers\ActionController::class . ':update'); $app->delete('/actions/{id}', \Action\controllers\ActionController::class . ':delete'); -//Administration -$app->get('/administration', \SrcCore\controllers\CoreController::class . ':getAdministration'); - //Attachments $app->post('/attachments', \Attachment\controllers\AttachmentController::class . ':create'); $app->get('/attachments/{id}/content', \Attachment\controllers\AttachmentController::class . ':getFileContent'); @@ -229,7 +226,6 @@ $app->get('/histories/resources/workflow/{resId}', \History\controllers\HistoryC //Header $app->get('/header', \SrcCore\controllers\CoreController::class . ':getHeader'); -$app->get('/shortcuts', \SrcCore\controllers\CoreController::class . ':getShortcuts'); //Home $app->get('/home', \Home\controllers\HomeController::class . ':get'); diff --git a/src/core/controllers/CoreController.php b/src/core/controllers/CoreController.php index 67036258e4b..b1da691a16c 100755 --- a/src/core/controllers/CoreController.php +++ b/src/core/controllers/CoreController.php @@ -88,56 +88,6 @@ class CoreController ]); } - public function getShortcuts(Request $request, Response $response) - { - $shortcuts = [ - ['id' => 'home'] - ]; - - if (ServiceController::hasPrivilege(['privilegeId' => 'admin', 'userId' => $GLOBALS['id']])) { - $shortcuts[] = ['id' => 'administration']; - } - if (ServiceController::hasPrivilege(['privilegeId' => 'adv_search_mlb', 'userId' => $GLOBALS['id']])) { - $shortcuts[] = ['id' => 'search']; - } - - $indexingGroups = []; - $userGroups = UserModel::getGroupsByUser(['id' => $GLOBALS['id']]); - foreach ($userGroups as $group) { - if ($group['can_index']) { - $indexingGroups[] = ['id' => $group['id'], 'label' => $group['group_desc']]; - } - } - if (!empty($indexingGroups)) { - $shortcuts[] = [ - 'id' => 'indexing', - 'groups' => $indexingGroups - ]; - } - - return $response->withJson(['shortcuts' => $shortcuts]); - } - - public function getAdministration(Request $request, Response $response) - { - if (!ServiceController::hasPrivilege(['privilegeId' => 'admin', 'userId' => $GLOBALS['id']])) { - return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); - } - - if ($GLOBALS['userId'] == 'superadmin') { - $administration = []; - $administrationApplication = ServiceModel::getApplicationServicesByXML(['type' => 'admin']); - $administrationModule = ServiceModel::getModulesServicesByXML(['type' => 'admin']); - $administration['administrations'] = array_merge_recursive($administrationApplication, $administrationModule); -// $administration = ServiceController::PRIVILEGE_MENU; - } else { - $administration = ServiceModel::getAdministrationServicesByUserId(['userId' => $GLOBALS['userId']]); -// $administration = ServiceController::getAdministrationPrivilegesByUserId(['userId' => $GLOBALS['id']]); - } - - return $response->withJson($administration); - } - public static function setGlobals(array $args) { ValidatorModel::notEmpty($args, ['login']); -- GitLab