Fixed #6349 - add view permission for print all assigned

This commit is contained in:
snipe 2018-10-19 16:43:28 -07:00
parent d6f8d1b464
commit 1a10aa0dda
2 changed files with 33 additions and 25 deletions

View file

@ -984,7 +984,7 @@ class UsersController extends Controller
*/
public function printInventory($id)
{
$this->authorize('view', User::class);
$show_user = User::where('id',$id)->withTrashed()->first();
$assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get();
$licenses = $show_user->licenses()->get();

View file

@ -237,37 +237,45 @@
<div class="col-md-12">
<a href="{{ route('users.edit', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.edit') }}</a>
</div>
@endcan
@can('create', $user)
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.clone') }}</a>
</div>
@endcan
@can('view', $user)
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.print_assigned') }}</a>
</div>
@can('delete', $user)
@if ($user->deleted_at=='')
<div class="col-md-12" style="padding-top: 5px;">
<form action="{{route('users.destroy',$user->id)}}" method="POST">
{{csrf_field()}}
{{ method_field("DELETE")}}
<button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.delete')}}</button>
</form>
</div>
<div class="col-md-12" style="padding-top: 5px;">
<form action="{{ route('users/bulkedit') }}" method="POST">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="ids[{{ $user->id }}]" value="{{ $user->id }}" />
<button style="width: 100%;" class="btn btn-sm btn-danger hidden-print">{{ trans('button.checkin_and_delete') }}</button>
</form>
</div>
@else
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('restore/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</a>
</div>
@endif
@endcan
@endcan
@can('delete', $user)
@if ($user->deleted_at=='')
<div class="col-md-12" style="padding-top: 5px;">
<form action="{{route('users.destroy',$user->id)}}" method="POST">
{{csrf_field()}}
{{ method_field("DELETE")}}
<button style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.delete')}}</button>
</form>
</div>
<div class="col-md-12" style="padding-top: 5px;">
<form action="{{ route('users/bulkedit') }}" method="POST">
<!-- CSRF Token -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="ids[{{ $user->id }}]" value="{{ $user->id }}" />
<button style="width: 100%;" class="btn btn-sm btn-danger hidden-print">{{ trans('button.checkin_and_delete') }}</button>
</form>
</div>
@else
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('restore/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-warning hidden-print">{{ trans('button.restore') }}</a>
</div>
@endif
@endcan
</div>
<!-- End button column -->
</div> <!--/.row-->