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>{{ $license->name }}</td>
<td> <td>
@if (($user->hasAccess('admin')) || ($user->hasAccess('license_keys'))) @can('licenses.keys')
{{ mb_strimwidth($license->serial, 0, 50, "...") }} {{ mb_strimwidth($license->serial, 0, 50, "...") }}
@else @else
--- ---
@endif @endcan
</td> </td>
</tr> </tr>
@endforeach @endforeach

View file

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