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]
* @return \Illuminate\Contracts\View\View
*/
public function edit($id = null)
public function edit($id)
{
$group = Group::find($id);
@ -95,7 +95,7 @@ class GroupsController extends Controller
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
$rules = [

View file

@ -25,7 +25,7 @@ class LicensesTransformer
'name' => e($license->name),
'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,
'product_key' => e($license->serial),
'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------',
'order_number' => e($license->order_number),
'purchase_order' => e($license->purchase_order),
'purchase_date' => Helper::getFormattedDateObject($license->purchase_date, 'date'),

View file

@ -1000,7 +1000,7 @@ class Asset extends Depreciable
}
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 . '%');
}

View file

@ -17,14 +17,7 @@ return array(
'label' => '',
'note' => 'Determines whether the user has access to most aspects of the admin. ',
'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(

View file

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

View file

@ -6,60 +6,177 @@
])
@section('content')
<style>
label.radio-padding {
margin-right: 25px;
}
</style>
<style>
.form-horizontal .control-label {
padding-top: 0px;
}
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
@stop
@section('inputFields')
<!-- Name -->
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-3 control-label">{{ trans('admin/groups/titles.group_name') }}
<i class='fa fa-asterisk'></i>
</label>
<label for="name" class="col-md-3 control-label">{{ trans('admin/groups/titles.group_name') }}</label>
<div class="col-md-6 required">
<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>') !!}
</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)
@for ($i = 0; $i < count($permission); $i++)
<tr class="header-row permissions-row">
<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
$permission_name = $permission[$i]['permission'];
?>
@if ($permission[$i]['display'])
<div class="col-md-9 col-md-offset-2">
<h3>{{ $area }}: {{ $permission[$i]['label'] }}</h3>
<p>{{ $permission[$i]['note'] }}</p>
<tr class="header-row permissions-row">
<td class="col-md-5 tooltip-base permissions-item header-name"
data-toggle="tooltip"
data-placement="right"
title="{{ $localPermission['note'] }}">
<h4>{{ $area . ': ' . $localPermission['label'] }}</h4>
<p>{{ $localPermission['note'] }}</p>
<!-- radio -->
<div class="form-group" style="padding-left: 15px;">
<label class="radio-padding col-md-3">
{{ Form::radio('permission['.$permission_name.']', 1,
(is_array($groupPermissions))
&& (array_key_exists($permission_name, $groupPermissions)
&& $groupPermissions[$permission_name]), ['class' => 'minimal']) }}
Grant
</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>
</td>
<td class="col-md-1 permissions-item" style="vertical-align: bottom">
{{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
</td>
<td class="col-md-1 permissions-item">
{{ Form::radio("$area", '0',false,['value'=>"deny", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
</td>
</tr>
</div>
<hr>
</div>
@foreach ($area_permission as $index => $this_permission)
@if ($this_permission['display'])
<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
@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

View file

@ -7,8 +7,8 @@
@stop
@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('settings.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</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 text-right">{{ trans('general.back') }}</a>
@stop

View file

@ -7,7 +7,7 @@
@stop
@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>
@stop

View file

@ -86,7 +86,7 @@
'company_id'=>e(Input::get('company_id')),
'status_id'=>e(Input::get('status_id'))))}}"
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>
</div><!-- /.col -->
</div><!-- /.row -->

View file

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

View file

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