Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
@@ -353,6 +353,7 @@ class UsersController extends AdminController {
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
// Do we have permission to delete this user?
|
||||
if ($user->isSuperUser() and ! Sentry::getUser()->isSuperUser())
|
||||
{
|
||||
@@ -360,6 +361,18 @@ class UsersController extends AdminController {
|
||||
return Redirect::route('users')->with('error', 'Insufficient permissions!');
|
||||
}
|
||||
|
||||
if (count($user->assets) > 0) {
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'This user still has '.count($user->assets).' assets associated with them.');
|
||||
}
|
||||
|
||||
if (count($user->licenses) > 0) {
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', 'This user still has '.count($user->licenses).' licenses associated with them.');
|
||||
}
|
||||
|
||||
// Delete the user
|
||||
$user->delete();
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ class Asset extends Elegant {
|
||||
public static function assetcount()
|
||||
{
|
||||
return DB::table('assets')
|
||||
|
||||
->where('physical', '=', '1')
|
||||
->whereNull('deleted_at','and')
|
||||
->count();
|
||||
|
||||
@@ -17,7 +17,13 @@ View User {{ $user->fullName() }} ::
|
||||
<h3 class="name">{{ $user->fullName() }}</h3>
|
||||
<span class="area">{{ $user->jobtitle }}</span>
|
||||
</div>
|
||||
<a href="{{ route('update/user', $user->id) }}" class="btn-flat white large pull-right edit"><i class="icon-pencil"></i> @lang('button.edit') This User</a>
|
||||
@if ($user->deleted_at != NULL)
|
||||
<a href="{{ route('restore/user', $user->id) }}" class="btn btn-warning pull-right edit"><i class="icon-pencil"></i> Restore This User</a>
|
||||
|
||||
@else
|
||||
<a href="{{ route('update/user', $user->id) }}" class="btn-flat white large pull-right edit"><i class="icon-pencil"></i> @lang('button.edit') This User</a>
|
||||
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="row profile">
|
||||
@@ -26,6 +32,17 @@ View User {{ $user->fullName() }} ::
|
||||
<div class="col-md-9 bio">
|
||||
<div class="profile-box">
|
||||
|
||||
@if ($user->deleted_at != NULL)
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
<i class="icon-exclamation-sign"></i>
|
||||
<strong>Warning: </strong>
|
||||
This user has been deleted. You will have to restore this user to edit them or assign them new assets.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
<h6>Assets Checked Out to {{ $user->first_name }}</h6>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user