From 33ebb222a6185e89a45c247400e7d30cd5382f7a Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Fri, 19 Jul 2019 11:04:20 +0200 Subject: [PATCH] FIX entities --- src/app/group/controllers/GroupController.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/group/controllers/GroupController.php b/src/app/group/controllers/GroupController.php index 80eb2a949c0..a94a80488d3 100755 --- a/src/app/group/controllers/GroupController.php +++ b/src/app/group/controllers/GroupController.php @@ -141,7 +141,7 @@ class GroupController return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } - $group = GroupModel::getById(['id' => $aArgs['id'], 'select' => ['id', 'group_id', 'group_desc', 'enabled']]); + $group = GroupModel::getById(['id' => $aArgs['id'], 'select' => ['id', 'group_id', 'group_desc']]); if (empty($group)) { return $response->withStatus(400)->withJson(['errors' => 'Group not found']); } @@ -250,10 +250,8 @@ class GroupController $allEntities[$key]['parent'] = $value['parent_id']; $allEntities[$key]['icon'] = "fa fa-sitemap"; } - $allEntities[$key]['state']['opened'] = false; - $allEntities[$key]['allowed'] = true; + $allEntities[$key]['state']['opened'] = true; if (in_array($value['id'], $group['indexationParameters']['entities'])) { - $allEntities[$key]['state']['opened'] = true; $allEntities[$key]['state']['selected'] = true; } @@ -269,6 +267,11 @@ class GroupController return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } + $body = $request->getParsedBody(); + if (!Validator::boolType()->validate($body['canIndex'])) { + return $response->withStatus(400)->withJson(['errors' => 'Body canIndex is empty or not a boolean']); + } + $group = GroupModel::getById(['id' => $args['id'], 'select' => ['indexation_parameters']]); if (empty($group)) { return $response->withStatus(400)->withJson(['errors' => 'Group not found']); @@ -276,11 +279,6 @@ class GroupController $indexationParameters = json_decode($group['indexation_parameters'], true); - $body = $request->getParsedBody(); - if (!Validator::boolType()->validate($body['canIndex'])) { - return $response->withStatus(400)->withJson(['errors' => 'Body canIndex is empty or not a boolean']); - } - if (!empty($body['actions']) && is_array($body['actions'])) { $countActions = ActionModel::get(['select' => ['count(1)'], 'where' => ['id in (?)'], 'data' => [$body['actions']]]); if ($countActions[0]['count'] != count($body['actions'])) { -- GitLab