Merge branch 'develop'

This commit is contained in:
snipe 2017-12-05 18:13:08 -08:00
commit 0d92ffc7ed
12 changed files with 205 additions and 97 deletions

View file

@ -84,7 +84,7 @@ class GroupsController extends Controller
* @since [v1.0] * @since [v1.0]
* @return \Illuminate\Contracts\View\View * @return \Illuminate\Contracts\View\View
*/ */
public function edit($id = null) public function edit($id)
{ {
$group = Group::find($id); $group = Group::find($id);
@ -95,7 +95,7 @@ class GroupsController extends Controller
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions')); return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
} }
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id'))); return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found'));
} }
/** /**

View file

@ -288,7 +288,7 @@ class LicensesController extends Controller
} }
$this->authorize('checkout', $licenseSeat); $this->authorize('checkout', $license);
// Declare the rules for the form validation // Declare the rules for the form validation
$rules = [ $rules = [

View file

@ -25,7 +25,7 @@ class LicensesTransformer
'name' => e($license->name), 'name' => e($license->name),
'company' => ($license->company) ? ['id' => (int) $license->company->id,'name'=> e($license->company->name)] : null, 'company' => ($license->company) ? ['id' => (int) $license->company->id,'name'=> e($license->company->name)] : null,
'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id,'name'=> e($license->manufacturer->name)] : null, 'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id,'name'=> e($license->manufacturer->name)] : null,
'product_key' => e($license->serial), 'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------',
'order_number' => e($license->order_number), 'order_number' => e($license->order_number),
'purchase_order' => e($license->purchase_order), 'purchase_order' => e($license->purchase_order),
'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'), 'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'),

View file

@ -1000,7 +1000,7 @@ class Asset extends Depreciable
} }
if (($fieldname!='category') && ($fieldname!='location') if (($fieldname!='category') && ($fieldname!='location')
&& ($fieldname!='status_label') && ($fieldname!='model') && ($fieldname!='manufacturer')) { && ($fieldname!='status_label') && ($fieldname!='model') && ($fieldname!='company') && ($fieldname!='manufacturer')) {
$query->orWhere('assets.'.$fieldname, 'LIKE', '%' . $search_val . '%'); $query->orWhere('assets.'.$fieldname, 'LIKE', '%' . $search_val . '%');
} }

View file

@ -17,14 +17,7 @@ return array(
'label' => '', 'label' => '',
'note' => 'Determines whether the user has access to most aspects of the admin. ', 'note' => 'Determines whether the user has access to most aspects of the admin. ',
'display' => true, 'display' => true,
), )
array(
'permission' => 'admin.api_key',
'label' => 'Create API Key',
'note' => 'Determines whether the user can access the API via API key.',
'display' => false,
),
), ),
'Reports' => array( 'Reports' => array(

View file

@ -101,9 +101,9 @@ View Assets for {{ $user->present()->fullName() }}
<td>{{ $license->name }}</td> <td>{{ $license->name }}</td>
<td> <td>
@can('viewKeys', $license) @can('viewKeys', $license)
{{ mb_strimwidth($license->serial, 0, 50, "...") }} {{ mb_strimwidth($license->serial, 0, 50, "...") }}
@else @else
--- ------------
@endcan @endcan
</td> </td>
</tr> </tr>

View file

@ -6,60 +6,177 @@
]) ])
@section('content') @section('content')
<style>
label.radio-padding { <style>
margin-right: 25px; .form-horizontal .control-label {
} padding-top: 0px;
</style> }
input[type='text'][disabled], input[disabled], textarea[disabled], input[readonly], textarea[readonly], .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
background-color: white;
color: #555555;
cursor:text;
}
table.permissions {
display:flex;
flex-direction: column;
}
.permissions.table > thead, .permissions.table > tbody {
margin: 15px;
margin-top: 0px;
}
.permissions.table > tbody+tbody {
}
.header-row {
border-bottom: 1px solid #ccc;
}
.header-row h3 {
margin:0px;
}
.permissions-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.table > tbody > tr > td.permissions-item {
padding: 1px;
padding-left: 8px;
}
.header-name {
cursor: pointer;
}
</style>
@parent @parent
@stop @stop
@section('inputFields') @section('inputFields')
<!-- Name --> <!-- Name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}"> <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ trans('admin/groups/titles.group_name') }} <label for="name" class="col-md-3 control-label">{{ trans('admin/groups/titles.group_name') }}</label>
<i class='fa fa-asterisk'></i>
</label>
<div class="col-md-6 required"> <div class="col-md-6 required">
<input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $group->name) }}" /> <input class="form-control" type="text" name="name" id="name" value="{{ Input::old('name', $group->name) }}" />
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!} {!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div> </div>
</div> </div>
<div class="col-md-12">
<table class="table table-striped permissions">
<thead>
<tr class="permissions-row">
<th class="col-md-5">Permission</th>
<th class="col-md-1">Grant</th>
<th class="col-md-1">Deny</th>
</tr>
</thead>
<tbody class="permissions-group">
@foreach ($permissions as $area => $area_permission)
<!-- handle superadmin and reports, and anything else with only one option -->
<?php $localPermission = $area_permission[0]; ?>
@if (count($area_permission) == 1)
@foreach ($permissions as $area => $permission) <tr class="header-row permissions-row">
@for ($i = 0; $i < count($permission); $i++) <td class="col-md-5 tooltip-base permissions-item"
data-toggle="tooltip"
data-placement="right"
title="{{ $localPermission['note'] }}">
<h4>{{ $area . ': ' . $localPermission['label'] }}</h4>
</td>
<td class="col-md-1 permissions-item">
{{ Form::radio('permission['.$localPermission['permission'].']', '1',$groupPermissions[$localPermission['permission'] ] == '1',['value'=>"grant", 'class'=>'minimal']) }}
</td>
<td class="col-md-1 permissions-item">
{{ Form::radio('permission['.$localPermission['permission'].']', '0',$groupPermissions[$localPermission['permission'] ] == '0',['value'=>"grant", 'class'=>'minimal']) }}
</td>
</tr>
@else
<?php <tr class="header-row permissions-row">
$permission_name = $permission[$i]['permission']; <td class="col-md-5 tooltip-base permissions-item header-name"
?> data-toggle="tooltip"
@if ($permission[$i]['display']) data-placement="right"
<div class="col-md-9 col-md-offset-2"> title="{{ $localPermission['note'] }}">
<h3>{{ $area }}: {{ $permission[$i]['label'] }}</h3> <h4>{{ $area . ': ' . $localPermission['label'] }}</h4>
<p>{{ $permission[$i]['note'] }}</p> <p>{{ $localPermission['note'] }}</p>
<!-- radio --> </td>
<div class="form-group" style="padding-left: 15px;"> <td class="col-md-1 permissions-item" style="vertical-align: bottom">
<label class="radio-padding col-md-3"> {{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
{{ Form::radio('permission['.$permission_name.']', 1, </td>
(is_array($groupPermissions)) <td class="col-md-1 permissions-item">
&& (array_key_exists($permission_name, $groupPermissions) {{ Form::radio("$area", '0',false,['value'=>"deny", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
&& $groupPermissions[$permission_name]), ['class' => 'minimal']) }} </td>
Grant </tr>
</label>
<label class="radio-padding col-md-3">
{{ Form::radio('permission['.$permission_name.']', 0, ((is_array($groupPermissions) && !array_key_exists($permission_name, $groupPermissions)) || !$groupPermissions[$permission_name]), ['class' => 'minimal']) }}
Deny
</label>
</div> @foreach ($area_permission as $index => $this_permission)
<hr> @if ($this_permission['display'])
</div> <tr class="permissions-row">
<td
class="col-md-5 tooltip-base permissions-item"
data-toggle="tooltip"
data-placement="right"
title="{{ $this_permission['note'] }}">
{{ $this_permission['label'] }}
</td>
<td class="col-md-1 permissions-item">
{{ Form::radio('permission['.$this_permission['permission'].']', '1',$groupPermissions[$this_permission['permission'] ] == '1',['class'=>'minimal radiochecker-'.str_slug($area)]) }}
</td>
<td class="col-md-1 permissions-item">
{{ Form::radio('permission['.$this_permission['permission'].']', '0',$groupPermissions[$this_permission['permission'] ] == '0',['class'=>'minimal radiochecker-'.str_slug($area)]) }}
</td>
</tr>
@endif
@endforeach
<tr>
<td colspan="3"></td>
</tr>
@endif @endif
@endfor
@endforeach
@endforeach
</tbody>
</table>
</div>
@stop
@section('moar_scripts')
<script nonce="{{ csrf_token() }}">
$(document).ready(function(){
$('.tooltip-base').tooltip({container: 'body'});
$(".superuser").change(function() {
var perms = $(this).val();
if (perms =='1') {
$("#nonadmin").hide();
} else {
$("#nonadmin").show();
}
});
// Check/Uncheck all radio buttons in the group
$('tr.header-row input:radio').on('ifClicked', function () {
value = $(this).attr('value');
area = $(this).data('checker-group');
$('.radiochecker-'+area+'[value='+value+']').iCheck('check');
});
$('.header-name').click(function() {
$(this).parent().nextUntil('tr.header-row').slideToggle(500);
});
});
</script>
@stop @stop

View file

@ -7,8 +7,8 @@
@stop @stop
@section('header_right') @section('header_right')
<a href="{{ route('groups.create') }}" class="btn btn-primary pull-right" style="margin-left: 10px;"> {{ trans('general.create') }}</a> <a href="{{ route('groups.create') }}" class="btn btn-primary text-right"> {{ trans('general.create') }}</a>
<a href="{{ route('settings.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</a> <a href="{{ route('settings.index') }}" class="btn btn-default text-right">{{ trans('general.back') }}</a>
@stop @stop

View file

@ -7,7 +7,7 @@
@stop @stop
@section('header_right') @section('header_right')
<a href="{{ route('groups.edit', ['group' => $group->id]) }}" class="btn btn-sm btn-primary pull-right">{{ trans('admin/groups/titles.update') }} </a> <a href="{{ route('groups.edit', ['group' => $group->id]) }}" class="btn btn-primary text-right">{{ trans('admin/groups/titles.update') }} </a>
<a href="{{ route('groups.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</a> <a href="{{ route('groups.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</a>
@stop @stop

View file

@ -86,7 +86,7 @@
'company_id'=>e(Input::get('company_id')), 'company_id'=>e(Input::get('company_id')),
'status_id'=>e(Input::get('status_id'))))}}" 'status_id'=>e(Input::get('status_id'))))}}"
data-click-to-select="true" data-click-to-select="true"
data-cookie-id-table="{{ e(Input::get('status')) }}assetTable-{{ config('version.app_version') }}"> data-cookie-id-table="{{ e(Input::get('status')) }}assetTable">
</table> </table>
</div><!-- /.col --> </div><!-- /.col -->
</div><!-- /.row --> </div><!-- /.row -->

View file

@ -156,16 +156,21 @@
</tr> </tr>
@endif @endif
@can('viewKeys', $license)
@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;"> <td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">
{!! nl2br(e($license->serial)) !!} @can('viewKeys', $license)
{!! nl2br(e($license->serial)) !!}
@else
------------
@endcan
</td> </td>
</tr> </tr>
@endif @endif
@endcan
@if (!is_null($license->license_name)) @if (!is_null($license->license_name))
<tr> <tr>

View file

@ -456,16 +456,16 @@
<table class="table table-striped permissions"> <table class="table table-striped permissions">
<thead> <thead>
<tr class="permissions-row"> <tr class="permissions-row">
<th class="col-md-5"><span class="line"></span>Permission</th> <th class="col-md-5">Permission</th>
<th class="col-md-1"><span class="line"></span>Grant</th> <th class="col-md-1">Grant</th>
<th class="col-md-1"><span class="line"></span>Deny</th> <th class="col-md-1">Deny</th>
<th class="col-md-1"><span class="line"></span>Inherit</th> <th class="col-md-1">Inherit</th>
</tr> </tr>
</thead> </thead>
@foreach ($permissions as $area => $permissionsArray) @foreach ($permissions as $area => $permissionsArray)
@if (count($permissionsArray) == 1) @if (count($permissionsArray) == 1)
<tbody class="permissions-group">
<?php $localPermission = $permissionsArray[0]; ?> <?php $localPermission = $permissionsArray[0]; ?>
<tr class="header-row permissions-row"> <tr class="header-row permissions-row">
<td class="col-md-5 tooltip-base permissions-item" <td class="col-md-5 tooltip-base permissions-item"
@ -497,21 +497,21 @@
@endif @endif
</td> </td>
</tr> </tr>
</tbody>
@else @else
<tbody class="permissions-group">
<tr class="header-row permissions-row"> <tr class="header-row permissions-row">
<td class="col-md-5 header-name"> <td class="col-md-5 header-name">
<h3>{{ $area }}</h3> <h3>{{ $area }}</h3>
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
{{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal']) }} {{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
{{ Form::radio("$area", '-1',false,['value'=>"deny", 'class'=>'minimal']) }} {{ Form::radio("$area", '-1',false,['value'=>"deny", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
{{ Form::radio("$area", '0',false,['value'=>"inherit", 'class'=>'minimal'] ) }} {{ Form::radio("$area", '0',false,['value'=>"inherit", 'class'=>'minimal', 'data-checker-group' => str_slug($area)] ) }}
</td> </td>
</tr> </tr>
@ -527,31 +527,32 @@
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser())) @if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[$permission['permission'] ] == '1', ["value"=>"grant", 'disabled'=>'disabled', 'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[$permission['permission'] ] == '1', ["value"=>"grant", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@else @else
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[ $permission['permission'] ] == '1', ["value"=>"grant",'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[ $permission['permission'] ] == '1', ["value"=>"grant",'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@endif @endif
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser())) @if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny", 'disabled'=>'disabled', 'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@else @else
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny",'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny",'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@endif @endif
</td> </td>
<td class="col-md-1 permissions-item"> <td class="col-md-1 permissions-item">
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser())) @if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'disabled'=>'disabled', 'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@else @else
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'class'=>'minimal']) }} {{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
@endif @endif
</td> </td>
@endif @endif
</tr> </tr>
@endforeach @endforeach
</tbody>
@endif @endif
@endforeach @endforeach
</tbody>
</table> </table>
</div><!-- /.tab-pane --> </div><!-- /.tab-pane -->
</div><!-- /.tab-content --> </div><!-- /.tab-content -->
@ -565,6 +566,8 @@
@stop @stop
@section('moar_scripts') @section('moar_scripts')
<script src="{{ asset('js/pGenerator.jquery.js') }}"></script>
<script nonce="{{ csrf_token() }}"> <script nonce="{{ csrf_token() }}">
$(document).ready(function() { $(document).ready(function() {
@ -579,28 +582,17 @@ $(document).ready(function() {
} }
}); });
});
</script>
<script nonce="{{ csrf_token() }}"> // Check/Uncheck all radio buttons in the group
$('tr.header-row input:radio').on('ifClicked', function () { $('tr.header-row input:radio').on('ifClicked', function () {
value = $(this).attr('value'); value = $(this).attr('value');
$(this).parent().parent().parent().siblings().each(function(idx,elem) { area = $(this).data('checker-group');
$(this).find('td input:radio[value='+value+']').iCheck('check'); $('.radiochecker-'+area+'[value='+value+']').iCheck('check');
}) });
});
$('.header-name').click(function() { $('.header-name').click(function() {
$(this).parent().nextUntil('tr.header-row').slideToggle(500); $(this).parent().nextUntil('tr.header-row').slideToggle(500);
}) });
</script>
<script src="{{ asset('js/pGenerator.jquery.js') }}"></script>
<script nonce="{{ csrf_token() }}">
$(document).ready(function(){
$('.tooltip-base').tooltip({container: 'body'}) $('.tooltip-base').tooltip({container: 'body'})
$(".superuser").change(function() { $(".superuser").change(function() {
@ -622,10 +614,9 @@ $(document).ready(function(){
'numbers': true, 'numbers': true,
'specialChars': true, 'specialChars': true,
'onPasswordGenerated': function(generatedPassword) { 'onPasswordGenerated': function(generatedPassword) {
$('#password_confirm').val($('#password').val()); $('#password_confirm').val($('#password').val());
} }
}); });
});
$("#two_factor_reset").click(function(){ $("#two_factor_reset").click(function(){
$("#two_factor_resetrow").removeClass('success'); $("#two_factor_resetrow").removeClass('success');
@ -654,6 +645,8 @@ $(document).ready(function(){
}); });
});
</script> </script>
@stop @stop