diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 87f3f95812..189f57b331 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -268,6 +268,12 @@ class AuthServiceProvider extends ServiceProvider } }); + $gate->define('licenses.keys', function ($user) { + if (($user->hasAccess('licenses.keys')) || ($user->hasAccess('admin'))) { + return true; + } + }); + } } diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 7934c9276c..f294de0961 100755 --- a/resources/views/account/view-assets.blade.php +++ b/resources/views/account/view-assets.blade.php @@ -102,12 +102,12 @@ View Assets for {{ $user->fullName() }} {{ $license->name }} - @if (($user->hasAccess('admin')) || ($user->hasAccess('license_keys'))) + @can('licenses.keys') - {{ mb_strimwidth($license->serial, 0, 50, "...") }} - @else - --- - @endif + {{ mb_strimwidth($license->serial, 0, 50, "...") }} + @else + --- + @endcan @endforeach diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 2158409fc8..a81f87694d 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -10,6 +10,7 @@ {{-- Right header --}} @section('header_right')
+ @can('licenses.edit') @@ -17,6 +18,7 @@
  • {{ trans('admin/licenses/general.edit') }}
  • {{ trans('admin/licenses/general.clone') }}
  • + @endcan
    @stop @@ -60,39 +62,57 @@ Seat {{ $count }} @if (($licensedto->assigned_to) && ($licensedto->deleted_at == NULL)) - - {{ $licensedto->user->fullName() }} - + @can('users.view') + + {{ $licensedto->user->fullName() }} + + @else + {{ $licensedto->user->fullName() }} + @endcan + @elseif (($licensedto->assigned_to) && ($licensedto->deleted_at != NULL)) {{ $licensedto->user->fullName() }} @elseif ($licensedto->asset_id) @if ($licensedto->asset->assigned_to != 0) - + @can('users.view') + + {{ $licensedto->asset->assigneduser->fullName() }} + + @else {{ $licensedto->asset->assigneduser->fullName() }} - + @endcan + @endif @endif @if ($licensedto->asset_id) - - {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} - + @can('assets.view') + + {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} + + @else + {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} + @endcan + @endif - @if (($licensedto->assigned_to) || ($licensedto->asset_id)) - @if ($license->reassignable) - - {{ trans('general.checkin') }} - - @else - Assigned - @endif - @else - - {{ trans('general.checkout') }} - @endif + @can('licenses.checkout') + @if (($licensedto->assigned_to) || ($licensedto->asset_id)) + + @if ($license->reassignable) + + {{ trans('general.checkin') }} + + @else + Assigned + @endif + @else + + {{ trans('general.checkout') }} + @endif + @endcan @@ -116,12 +136,14 @@ @endif - @if (!is_null($license->serial)) - - {{ trans('admin/licenses/form.license_key') }} - {!! nl2br(e($license->serial)) !!} - - @endif + @can('licenses.keys') + @if (!is_null($license->serial)) + + {{ trans('admin/licenses/form.license_key') }} + {!! nl2br(e($license->serial)) !!} + + @endif + @endcan @if (!is_null($license->license_name))