A few more permissions tweaks

This commit is contained in:
snipe 2016-07-28 21:31:53 -07:00
parent 8a9307f357
commit 47f6635992
3 changed files with 59 additions and 31 deletions

View file

@ -268,6 +268,12 @@ class AuthServiceProvider extends ServiceProvider
}
});
$gate->define('licenses.keys', function ($user) {
if (($user->hasAccess('licenses.keys')) || ($user->hasAccess('admin'))) {
return true;
}
});
}
}

View file

@ -102,12 +102,12 @@ View Assets for {{ $user->fullName() }}
<td>{{ $license->name }}</td>
<td>
@if (($user->hasAccess('admin')) || ($user->hasAccess('license_keys')))
@can('licenses.keys')
{{ mb_strimwidth($license->serial, 0, 50, "...") }}
@else
---
@endif
@endcan
</td>
</tr>
@endforeach

View file

@ -10,6 +10,7 @@
{{-- Right header --}}
@section('header_right')
<div class="btn-group pull-right">
@can('licenses.edit')
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
@ -17,6 +18,7 @@
<li><a href="{{ route('update/license', $license->id) }}">{{ trans('admin/licenses/general.edit') }}</a></li>
<li><a href="{{ route('clone/license', $license->id) }}">{{ trans('admin/licenses/general.clone') }}</a></li>
</ul>
@endcan
</div>
@stop
@ -60,28 +62,45 @@
<td>Seat {{ $count }} </td>
<td>
@if (($licensedto->assigned_to) && ($licensedto->deleted_at == NULL))
@can('users.view')
<a href="{{ route('view/user', $licensedto->assigned_to) }}">
{{ $licensedto->user->fullName() }}
</a>
@else
{{ $licensedto->user->fullName() }}
@endcan
@elseif (($licensedto->assigned_to) && ($licensedto->deleted_at != NULL))
<del>{{ $licensedto->user->fullName() }}</del>
@elseif ($licensedto->asset_id)
@if ($licensedto->asset->assigned_to != 0)
@can('users.view')
<a href="{{ route('view/user', $licensedto->asset->assigned_to) }}">
{{ $licensedto->asset->assigneduser->fullName() }}
</a>
@else
{{ $licensedto->asset->assigneduser->fullName() }}
@endcan
@endif
@endif
</td>
<td>
@if ($licensedto->asset_id)
@can('assets.view')
<a href="{{ route('view/hardware', $licensedto->asset_id) }}">
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
</a>
@else
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
@endcan
@endif
</td>
<td>
@can('licenses.checkout')
@if (($licensedto->assigned_to) || ($licensedto->asset_id))
@if ($license->reassignable)
<a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm">
{{ trans('general.checkin') }}
@ -93,6 +112,7 @@
<a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm">
{{ trans('general.checkout') }}</a>
@endif
@endcan
</td>
</tr>
@ -116,12 +136,14 @@
</tr>
@endif
@can('licenses.keys')
@if (!is_null($license->serial))
<tr>
<td>{{ trans('admin/licenses/form.license_key') }}</td>
<td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">{!! nl2br(e($license->serial)) !!}</td>
</tr>
@endif
@endcan
@if (!is_null($license->license_name))
<tr>