diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 87fc6b458..571ae184b 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -626,12 +626,12 @@ class AssetsController extends Controller if ($asset->save()) { if ($request->input('checkin_at') == Carbon::now()->format('Y-m-d')) { - $checkout_at = Carbon::now(); + $checkin_at = Carbon::now(); } else { - $checkout_at = $request->input('checkin_at').' 00:00:00'; + $checkin_at = $request->input('checkin_at').' 00:00:00'; } - //$checkout_at = e(Input::get('checkin_at')); - $logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkout_at); + //$checkin_at = e(Input::get('checkin_at')); + $logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkin_at); $settings = Setting::getSettings(); diff --git a/app/Models/User.php b/app/Models/User.php index 282447c8b..69facdb00 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -55,7 +55,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon $user_permissions = json_decode($this->permissions, true); - //If the user is explicitly granted, return false + //If the user is explicitly granted, return true if (($user_permissions!='') && ((array_key_exists($section, $user_permissions)) && ($user_permissions[$section]=='1'))) { return true; } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 87f3f9581..d33f45143 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -205,7 +205,7 @@ class AuthServiceProvider extends ServiceProvider # Components # ----------------------------------------- $gate->define('components.view', function ($user) { - if (($user->hasAccess('components.create')) || ($user->hasAccess('admin'))) { + if (($user->hasAccess('components.view')) || ($user->hasAccess('admin'))) { return true; } }); @@ -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/requestable-assets.blade.php b/resources/views/account/requestable-assets.blade.php index 1fe66b387..78c099249 100644 --- a/resources/views/account/requestable-assets.blade.php +++ b/resources/views/account/requestable-assets.blade.php @@ -26,10 +26,12 @@ - + + + @@ -44,15 +46,28 @@ @endif + + + + @if ($asset->assigned_to != '' && $asset->assigned_to > 0) + + @else + + @endif + + + + + diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 7934c9276..f294de096 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() }} @endforeach diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index a07b84de5..67d16f75c 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -249,11 +249,11 @@ - @if ($asset->created_at) + @if ($asset->created_at!=''') @endif diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 5ce12542a..3f1fca4e4 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 @@ @@ -116,24 +136,26 @@ @endif - @if (!is_null($license->serial)) - - - - - @endif + @can('licenses.keys') + @if (!is_null($license->serial)) + + + + + @endif + @endcan @if (!is_null($license->license_name)) - + @endif @if (!is_null($license->license_email)) - + @endif @@ -270,7 +292,7 @@ - + ey
    {{ trans('admin/hardware/table.asset_model') }} {{ trans('admin/hardware/table.serial') }} {{ trans('admin/hardware/table.location') }}{{ trans('admin/hardware/table.status') }}{{ trans('admin/hardware/form.expected_checkin') }} {{ trans('table.actions') }}
    {{ $asset->serial }} @if ($asset->assigneduser && $asset->assetloc) - {{ $asset->assetloc->name }} + {{ $asset->assetloc->name }} @elseif ($asset->defaultLoc) - {{ $asset->defaultLoc->name }} + {{ $asset->defaultLoc->name }} @endif Checked out{{ trans('admin/hardware/general.requestable') }}{{ $asset->expected_checkin }} {{ trans('button.request') }} {{ $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
    {{ trans('admin/hardware/form.notes') }} {!! nl2br(e($asset->notes)) !!}
    {{ trans('general.created_at') }} - {{ $user->created_at->format('F j, Y h:iA') }} + {{ $asset->created_at->format('F j, Y h:iA') }}
    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
    {{ trans('admin/licenses/form.license_key') }}{{ nl2br(e($license->serial)) }}
    {{ trans('admin/licenses/form.license_key') }}{!! nl2br(e($license->serial)) !!}
    {{ trans('admin/licenses/form.to_name') }}{{ nl2br(e($license->license_name)) }}{{ $license->license_name }}
    {{ trans('admin/licenses/form.to_email') }}{{ nl2br(e($license->license_email)) }}{{ $license->license_email }}