mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Add a clone button the the user table. (#2241)
Also preserve permissions when cloning a user, instead of nulling them by default.
This commit is contained in:
parent
f683c78a69
commit
ab3b9dcf5d
|
@ -689,14 +689,14 @@ class UsersController extends Controller
|
||||||
// Get this user groups
|
// Get this user groups
|
||||||
$userGroups = $user_to_clone->groups()->lists('name', 'id');
|
$userGroups = $user_to_clone->groups()->lists('name', 'id');
|
||||||
|
|
||||||
// Get this user permissions
|
|
||||||
$userPermissions = null;
|
|
||||||
|
|
||||||
// Get a list of all the available groups
|
// Get a list of all the available groups
|
||||||
$groups = Group::pluck('name', 'id');
|
$groups = Group::pluck('name', 'id');
|
||||||
|
|
||||||
// Get all the available permissions
|
// Get all the available permissions
|
||||||
$permissions = config('permissions');
|
$permissions = config('permissions');
|
||||||
|
$clonedPermissions = $user_to_clone->decodePermissions();
|
||||||
|
|
||||||
|
$userPermissions =Helper::selectedPermissionsArray($permissions, $clonedPermissions);
|
||||||
//$this->encodeAllPermissions($permissions);
|
//$this->encodeAllPermissions($permissions);
|
||||||
|
|
||||||
$location_list = Helper::locationsList();
|
$location_list = Helper::locationsList();
|
||||||
|
@ -933,6 +933,8 @@ class UsersController extends Controller
|
||||||
|
|
||||||
$actions .= '<a href="' . route('update/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
$actions .= '<a href="' . route('update/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||||
|
|
||||||
|
$actions .= '<a href="' . route('clone/user', $user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
|
||||||
|
|
||||||
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
||||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', $user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', $user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue