From ab3b9dcf5dcd1acce62054c64bbd6ab1dc157f26 Mon Sep 17 00:00:00 2001 From: Daniel Meltzer Date: Sun, 10 Jul 2016 21:43:10 -0400 Subject: [PATCH] Add a clone button the the user table. (#2241) Also preserve permissions when cloning a user, instead of nulling them by default. --- app/Http/Controllers/UsersController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 2e5bd3c353..32b599bd92 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -689,14 +689,14 @@ class UsersController extends Controller // Get this user groups $userGroups = $user_to_clone->groups()->lists('name', 'id'); - // Get this user permissions - $userPermissions = null; - // Get a list of all the available groups $groups = Group::pluck('name', 'id'); // Get all the available permissions $permissions = config('permissions'); + $clonedPermissions = $user_to_clone->decodePermissions(); + + $userPermissions =Helper::selectedPermissionsArray($permissions, $clonedPermissions); //$this->encodeAllPermissions($permissions); $location_list = Helper::locationsList(); @@ -933,6 +933,8 @@ class UsersController extends Controller $actions .= ' '; + $actions .= ''; + if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) { $actions .= ' '; } else {