Commit 43c6dd29 authored by Quentin Ribac's avatar Quentin Ribac
Browse files

FEAT #17436 TIME 0:30 remove summary query param & using correct checks

parent 2a4b9dc7
......@@ -106,9 +106,7 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']);
}
$queryParams = $request->getQueryParams();
$summaryOnly = ($queryParams['mode'] ?? null) == 'summary';
if (!$summaryOnly && UserController::hasRightByUserId(['activeUserId' => $GLOBALS['id'], 'targetUserId' => $args['id']])) {
if ($GLOBALS['id'] == $args['id'] || PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_users'])) {
$user = UserController::getUserInformationsById(['id' => $args['id']]);
} else {
$user = UserModel::getById(['select' => ['id', 'firstname', 'lastname', 'email', 'phone', 'substitute'], 'id' => $args['id']]);
......@@ -132,7 +130,7 @@ class UserController
if (!empty($groupsIds)) {
$groups = GroupModel::get(['select' => ['label', 'id'], 'where' => ['id in (?)'], 'data' => [$groupsIds]]);
$user['groups'] = $groups;
} elseif (!$actuallyAlone && !$summaryOnly) {
} elseif (!$actuallyAlone) {
return $response->withStatus(403)->withJson(['errors' => 'User out of perimeter']);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment