From e9726982fd9481c9987f9d1d678e72a73bce30a8 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 12 Sep 2020 23:03:38 +0200 Subject: [PATCH] Edit user: Allow groups admin to change own groups --- includes/pages/admin_user.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 3fc4c694..758ed8d9 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -141,7 +141,10 @@ function admin_user() $his_highest_group = $his_highest_group['group_id']; } - if ($user_id != $user->id && ($my_highest_group <= $his_highest_group || is_null($his_highest_group))) { + if ( + ($user_id != $user->id || auth()->can('admin_groups')) + && ($my_highest_group <= $his_highest_group || is_null($his_highest_group)) + ) { $html .= 'Hier kannst Du die Benutzergruppen des Engels festlegen:
' . "\n"; @@ -185,7 +188,7 @@ function admin_user() } else { switch ($request->input('action')) { case 'save_groups': - if ($user_id != $user->id) { + if ($user_id != $user->id || auth()->can('admin_groups')) { $my_highest_group = DB::selectOne( 'SELECT * FROM `UserGroups` WHERE `uid`=? ORDER BY `group_id`', [$user->id]