Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2016-07-29 12:15:45 -07:00
commit 3f54c034dd
7 changed files with 88 additions and 45 deletions

View file

@ -626,12 +626,12 @@ class AssetsController extends Controller
if ($asset->save()) { if ($asset->save()) {
if ($request->input('checkin_at') == Carbon::now()->format('Y-m-d')) { if ($request->input('checkin_at') == Carbon::now()->format('Y-m-d')) {
$checkout_at = Carbon::now(); $checkin_at = Carbon::now();
} else { } 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')); //$checkin_at = e(Input::get('checkin_at'));
$logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkout_at); $logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkin_at);
$settings = Setting::getSettings(); $settings = Setting::getSettings();

View file

@ -55,7 +55,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
$user_permissions = json_decode($this->permissions, true); $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'))) { if (($user_permissions!='') && ((array_key_exists($section, $user_permissions)) && ($user_permissions[$section]=='1'))) {
return true; return true;
} }

View file

@ -205,7 +205,7 @@ class AuthServiceProvider extends ServiceProvider
# Components # Components
# ----------------------------------------- # -----------------------------------------
$gate->define('components.view', function ($user) { $gate->define('components.view', function ($user) {
if (($user->hasAccess('components.create')) || ($user->hasAccess('admin'))) { if (($user->hasAccess('components.view')) || ($user->hasAccess('admin'))) {
return true; 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;
}
});
} }
} }

View file

@ -30,6 +30,8 @@
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th> <th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.serial') }}</th> <th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.serial') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.location') }}</th> <th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.location') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.status') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th> <th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
</tr> </tr>
</thead> </thead>
@ -44,6 +46,9 @@
@endif @endif
<td>{{ $asset->serial }}</td> <td>{{ $asset->serial }}</td>
<td> <td>
@if ($asset->assigneduser && $asset->assetloc) @if ($asset->assigneduser && $asset->assetloc)
{{ $asset->assetloc->name }} {{ $asset->assetloc->name }}
@ -53,6 +58,16 @@
@endif @endif
</td> </td>
@if ($asset->assigned_to != '' && $asset->assigned_to > 0)
<td>Checked out</td>
@else
<td>{{ trans('admin/hardware/general.requestable') }}</td>
@endif
<td>{{ $asset->expected_checkin }}</td>
<td> <td>
<a href="{{ route('account/request-asset', $asset->id) }}" class="btn btn-info btn-sm" title="{{ trans('button.request') }}">{{ trans('button.request') }}</a> <a href="{{ route('account/request-asset', $asset->id) }}" class="btn btn-info btn-sm" title="{{ trans('button.request') }}">{{ trans('button.request') }}</a>
</td> </td>

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

@ -249,11 +249,11 @@
<td>{{ trans('admin/hardware/form.notes') }}</td> <td>{{ trans('admin/hardware/form.notes') }}</td>
<td> {!! nl2br(e($asset->notes)) !!}</td> <td> {!! nl2br(e($asset->notes)) !!}</td>
</tr> </tr>
@if ($asset->created_at) @if ($asset->created_at!=''')
<tr> <tr>
<td>{{ trans('general.created_at') }}</td> <td>{{ trans('general.created_at') }}</td>
<td> <td>
{{ $user->created_at->format('F j, Y h:iA') }} {{ $asset->created_at->format('F j, Y h:iA') }}
</td> </td>
</tr> </tr>
@endif @endif

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,28 +62,45 @@
<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))
@can('users.view')
<a href="{{ route('view/user', $licensedto->assigned_to) }}"> <a href="{{ route('view/user', $licensedto->assigned_to) }}">
{{ $licensedto->user->fullName() }} {{ $licensedto->user->fullName() }}
</a> </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)
@can('users.view')
<a href="{{ route('view/user', $licensedto->asset->assigned_to) }}"> <a href="{{ route('view/user', $licensedto->asset->assigned_to) }}">
{{ $licensedto->asset->assigneduser->fullName() }} {{ $licensedto->asset->assigneduser->fullName() }}
</a> </a>
@else
{{ $licensedto->asset->assigneduser->fullName() }}
@endcan
@endif @endif
@endif @endif
</td> </td>
<td> <td>
@if ($licensedto->asset_id) @if ($licensedto->asset_id)
@can('assets.view')
<a href="{{ route('view/hardware', $licensedto->asset_id) }}"> <a href="{{ route('view/hardware', $licensedto->asset_id) }}">
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
</a> </a>
@else
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
@endcan
@endif @endif
</td> </td>
<td> <td>
@can('licenses.checkout')
@if (($licensedto->assigned_to) || ($licensedto->asset_id)) @if (($licensedto->assigned_to) || ($licensedto->asset_id))
@if ($license->reassignable) @if ($license->reassignable)
<a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm"> <a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm">
{{ trans('general.checkin') }} {{ trans('general.checkin') }}
@ -93,6 +112,7 @@
<a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm"> <a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm">
{{ trans('general.checkout') }}</a> {{ trans('general.checkout') }}</a>
@endif @endif
@endcan
</td> </td>
</tr> </tr>
@ -116,24 +136,26 @@
</tr> </tr>
@endif @endif
@can('licenses.keys')
@if (!is_null($license->serial)) @if (!is_null($license->serial))
<tr> <tr>
<td>{{ trans('admin/licenses/form.license_key') }}</td> <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> <td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">{!! nl2br(e($license->serial)) !!}</td>
</tr> </tr>
@endif @endif
@endcan
@if (!is_null($license->license_name)) @if (!is_null($license->license_name))
<tr> <tr>
<td>{{ trans('admin/licenses/form.to_name') }}</td> <td>{{ trans('admin/licenses/form.to_name') }}</td>
<td>{{ nl2br(e($license->license_name)) }}</td> <td>{{ $license->license_name }}</td>
</tr> </tr>
@endif @endif
@if (!is_null($license->license_email)) @if (!is_null($license->license_email))
<tr> <tr>
<td>{{ trans('admin/licenses/form.to_email') }}</td> <td>{{ trans('admin/licenses/form.to_email') }}</td>
<td>{{ nl2br(e($license->license_email)) }}</td> <td>{{ $license->license_email }}</td>
</tr> </tr>
@endif @endif
@ -270,7 +292,7 @@
</div> </div>
</div> </div>
</div> </div>ey
</div> </div>
<!-- /.tab-pane --> <!-- /.tab-pane -->