Skip to content
Snippets Groups Projects
Commit c821aa89 authored by Quentin Ribac's avatar Quentin Ribac
Browse files

FEAT #17436 TIME 0:20 extended GET/manageablegroups

parent afbb7680
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,6 @@ namespace Group\controllers; ...@@ -17,7 +17,6 @@ namespace Group\controllers;
use SrcCore\models\ValidatorModel; use SrcCore\models\ValidatorModel;
use User\models\UserGroupModel; use User\models\UserGroupModel;
use Group\models\GroupPrivilegeModel; use Group\models\GroupPrivilegeModel;
use PHPUnit\Util\Xml\Validator;
use User\controllers\UserController; use User\controllers\UserController;
class PrivilegeController class PrivilegeController
......
...@@ -826,7 +826,7 @@ class UserController ...@@ -826,7 +826,7 @@ class UserController
if (PrivilegeController::hasPrivilege(['userId' => $args['userId'], 'privilege' => 'manage_groups'])) { if (PrivilegeController::hasPrivilege(['userId' => $args['userId'], 'privilege' => 'manage_groups'])) {
$groups = GroupModel::get(['select' => ['id']]); $groups = GroupModel::get(['select' => ['id']]);
$groups = array_column($groups, 'id'); $groups = array_column($groups, 'id');
return $groups; return GroupModel::get();
} }
$groups = UserGroupModel::get(['select' => ['group_id'], 'where' => ['user_id = ?'], 'data' => [$args['userId']]]); $groups = UserGroupModel::get(['select' => ['group_id'], 'where' => ['user_id = ?'], 'data' => [$args['userId']]]);
...@@ -838,7 +838,13 @@ class UserController ...@@ -838,7 +838,13 @@ class UserController
$currentGroups = $parameters['authorized'] ?? []; $currentGroups = $parameters['authorized'] ?? [];
$manageableGroups = array_merge($manageableGroups, $currentGroups); $manageableGroups = array_merge($manageableGroups, $currentGroups);
} }
$manageableGroups = array_unique($manageableGroups);
return array_unique($manageableGroups); $manageableGroups = GroupModel::get([
'where' => ['id in (?)'],
'data' => [$manageableGroups]
]);
return $manageableGroups;
} }
} }
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