mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Rework permissions view (#2756)
* Early layout work on a cleaner permissions interface * Cleanup layout. Make new permissions view work. Still needs some css and javascript improvements. Also need to do the same thing to the group view. * Improve styling, add javascript to toggle an entire group of permissions if choosing the permission on the header row. Would be nice to add collapsing of sections in the future. * Toggle viewing sections. * Special case places where we only have one item in a group to only display the item once. * Filter getCreate the same way.
This commit is contained in:
parent
4b6ba6cb30
commit
2e0a7abbe9
|
@ -81,6 +81,7 @@ class UsersController extends Controller
|
|||
|
||||
$permissions = config('permissions');
|
||||
$userPermissions = Helper::selectedPermissionsArray($permissions, Input::old('permissions', array()));
|
||||
$permissions = $this->filterDisplayable($permissions);
|
||||
|
||||
$location_list = Helper::locationsList();
|
||||
$manager_list = Helper::managerList();
|
||||
|
@ -233,6 +234,17 @@ class UsersController extends Controller
|
|||
* @param int $id
|
||||
* @return View
|
||||
*/
|
||||
|
||||
private function filterDisplayable($permissions) {
|
||||
$output = null;
|
||||
foreach($permissions as $key=>$permission) {
|
||||
$output[$key] = array_filter($permission, function($p) {
|
||||
return $p['display'] === true;
|
||||
});
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getEdit($id = null)
|
||||
{
|
||||
try {
|
||||
|
@ -249,7 +261,7 @@ class UsersController extends Controller
|
|||
$userGroups = $user->groups()->pluck('name', 'id');
|
||||
$user->permissions = $user->decodePermissions();
|
||||
$userPermissions = Helper::selectedPermissionsArray($permissions, $user->permissions);
|
||||
|
||||
$permissions = $this->filterDisplayable($permissions);
|
||||
$location_list = Helper::locationsList();
|
||||
$company_list = Helper::companyList();
|
||||
$manager_list = Helper::managerList();
|
||||
|
@ -282,7 +294,6 @@ class UsersController extends Controller
|
|||
// permissions here before we update the user.
|
||||
$permissions = $request->input('permissions', array());
|
||||
app('request')->request->set('permissions', $permissions);
|
||||
|
||||
// Only update the email address if locking is set to false
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('users')->with('error', 'Denied! You cannot update user information on the demo.');
|
||||
|
@ -333,7 +344,6 @@ class UsersController extends Controller
|
|||
$user->notes = e($request->input('notes'));
|
||||
$user->permissions = json_encode($request->input('permission'));
|
||||
|
||||
|
||||
if ($user->manager_id == "") {
|
||||
$user->manager_id = null;
|
||||
}
|
||||
|
|
|
@ -126,41 +126,41 @@
|
|||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
@can('assets.view')
|
||||
<li {!! (Request::is('hardware*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('hardware') }}">
|
||||
<i class="fa fa-barcode"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('licenses.view')
|
||||
<li {!! (Request::is('admin/licenses*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/licenses') }}">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('accessories.view')
|
||||
<li {!! (Request::is('admin/accessories*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/accessories') }}">
|
||||
<i class="fa fa-keyboard-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('consumables.view')
|
||||
<li {!! (Request::is('admin/consumables*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/consumables') }}">
|
||||
<i class="fa fa-tint"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('components.view')
|
||||
<li {!! (Request::is('admin/components*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/components') }}">
|
||||
<i class="fa fa-hdd-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('assets.view')
|
||||
<li {!! (Request::is('hardware*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('hardware') }}">
|
||||
<i class="fa fa-barcode"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('licenses.view')
|
||||
<li {!! (Request::is('admin/licenses*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/licenses') }}">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('accessories.view')
|
||||
<li {!! (Request::is('admin/accessories*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/accessories') }}">
|
||||
<i class="fa fa-keyboard-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('consumables.view')
|
||||
<li {!! (Request::is('admin/consumables*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/consumables') }}">
|
||||
<i class="fa fa-tint"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('components.view')
|
||||
<li {!! (Request::is('admin/components*') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ URL::to('admin/components') }}">
|
||||
<i class="fa fa-hdd-o"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
|
||||
@can('assets.view')
|
||||
<form class="navbar-form navbar-left form-horizontal" role="search" action="{{ route('findbytag/hardware') }}" method="get">
|
||||
|
@ -227,7 +227,7 @@
|
|||
</li>
|
||||
@endcan
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
@endcan
|
||||
|
||||
@can('admin')
|
||||
|
@ -288,7 +288,6 @@
|
|||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
<li>
|
||||
<li {!! (Request::is('account/profile') ? ' class="active"' : '') !!}>
|
||||
<a href="{{ route('view-assets') }}">
|
||||
<i class="fa fa-check fa-fw"></i> @lang('general.viewassets')
|
||||
|
@ -304,7 +303,6 @@
|
|||
@lang('general.logout')
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
@ -434,7 +432,7 @@
|
|||
<li{!! (Request::query('status') == 'Pending' ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Pending') }}">@lang('general.pending')</a></li>
|
||||
<li{!! (Request::query('status') == 'Undeployable' ? ' class="active"' : '') !!} ><a href="{{ URL::to('hardware?status=Undeployable') }}">@lang('general.undeployable')</a></li>
|
||||
<li{!! (Request::query('status') == 'Archived' ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Archived') }}">@lang('admin/hardware/general.archived')</a></li>
|
||||
<li{!! (Request::query('status') == 'Requestable' ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Requestable') }}"><a href="{{ URL::to('hardware?status=Requestable') }}" >@lang('admin/hardware/general.requestable')</a></li>
|
||||
<li{!! (Request::query('status') == 'Requestable' ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Requestable') }}">@lang('admin/hardware/general.requestable')</a></li>
|
||||
|
||||
<li class="divider"> </li>
|
||||
<li{!! (Request::is('hardware/bulkcheckout') ? ' class="active>"' : '') !!}>
|
||||
|
|
|
@ -21,25 +21,58 @@
|
|||
@section('content')
|
||||
|
||||
<style>
|
||||
.form-horizontal .control-label {
|
||||
padding-top: 0px;
|
||||
}
|
||||
.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 {
|
||||
margin: 15px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
table, tbody {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.header-name {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
.radio-padding {
|
||||
padding-left: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
|
||||
|
||||
<form class="form-horizontal" method="post" action="" autocomplete="off" id="userForm">
|
||||
<form class="form-horizontal" method="post" autocomplete="off" id="userForm">
|
||||
<!-- CSRF Token -->
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
|
||||
|
@ -49,329 +82,406 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
|
|||
<li class="active"><a href="#tab_1" data-toggle="tab">Information</a></li>
|
||||
<li><a href="#tab_2" data-toggle="tab">Permissions</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab_1">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- First Name -->
|
||||
<div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="first_name">{{ trans('general.first_name') }}</label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'first_name')) ? ' required' : '' }}">
|
||||
<input class="form-control" type="text" name="first_name" id="first_name" value="{{ Input::old('first_name', $user->first_name) }}" />
|
||||
{!! $errors->first('first_name', '<span class="alert-msg">:message</span>') !!}
|
||||
<!-- First Name -->
|
||||
<div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="first_name">{{ trans('general.first_name') }}</label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'first_name')) ? ' required' : '' }}">
|
||||
<input class="form-control" type="text" name="first_name" id="first_name" value="{{ Input::old('first_name', $user->first_name) }}" />
|
||||
{!! $errors->first('first_name', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Last Name -->
|
||||
<div class="form-group {{ $errors->has('last_name') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="last_name">{{ trans('general.last_name') }} </label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'last_name')) ? ' required' : '' }}">
|
||||
<!-- Last Name -->
|
||||
<div class="form-group {{ $errors->has('last_name') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="last_name">{{ trans('general.last_name') }} </label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'last_name')) ? ' required' : '' }}">
|
||||
<input class="form-control" type="text" name="last_name" id="last_name" value="{{ Input::old('last_name', $user->last_name) }}" />
|
||||
{!! $errors->first('last_name', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Username -->
|
||||
<div class="form-group {{ $errors->has('username') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="username">{{ trans('admin/users/table.username') }}</label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'username')) ? ' required' : '' }}">
|
||||
@if ($user->ldap_import!='1')
|
||||
<input class="form-control" type="text" name="username" id="username" value="{{ Input::old('username', $user->username) }}" {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }} autocomplete="false" readonly onfocus="this.removeAttribute('readonly');">
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<!-- Username -->
|
||||
<div class="form-group {{ $errors->has('username') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="username">{{ trans('admin/users/table.username') }}</label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'username')) ? ' required' : '' }}">
|
||||
@if ($user->ldap_import!='1')
|
||||
<input
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="username"
|
||||
id="username"
|
||||
value="{{ Input::old('username', $user->username) }}"
|
||||
autocomplete="false"
|
||||
readonly
|
||||
onfocus="this.removeAttribute('readonly');"
|
||||
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
|
||||
>
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<p class="help-block">{{ trans('admin/users/table.lock_passwords') }}</p>
|
||||
@endif
|
||||
@else
|
||||
(Managed via LDAP)
|
||||
@endif
|
||||
|
||||
{!! $errors->first('username', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Password -->
|
||||
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="password">{{ trans('admin/users/table.password') }}
|
||||
</label>
|
||||
<div class="col-md-5{{ (\App\Helpers\Helper::checkIfRequired($user, 'password')) ? ' required' : '' }}">
|
||||
@if ($user->ldap_import!='1')
|
||||
<input type="password" name="password" class="form-control" id="password" value="" {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }} autocomplete="false" readonly onfocus="this.removeAttribute('readonly');">
|
||||
@else
|
||||
(Managed via LDAP)
|
||||
@endif
|
||||
<span id="generated-password"></span>
|
||||
{!! $errors->first('password', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@if ($user->ldap_import!='1')
|
||||
<a href="#" class="left" id="genPassword">Generate</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($user->ldap_import!='1')
|
||||
<!-- Password Confirm -->
|
||||
<div class="form-group {{ $errors->has('password_confirm') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="password_confirm">{{ trans('admin/users/table.password_confirm') }}
|
||||
</label>
|
||||
<div class="col-md-5{{ ((\App\Helpers\Helper::checkIfRequired($user, 'first_name')) && (!$user->id)) ? ' required' : '' }}">
|
||||
<input type="password" name="password_confirm" id="password_confirm" class="form-control" value="" {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }} autocomplete="off">
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<p class="help-block">{{ trans('admin/users/table.lock_passwords') }}</p>
|
||||
@endif
|
||||
{!! $errors->first('password_confirm', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<!-- Email -->
|
||||
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="email">{{ trans('admin/users/table.email') }} </label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'email')) ? ' required' : '' }}">
|
||||
<input class="form-control" type="text" name="email" id="email" value="{{ Input::old('email', $user->email) }}" {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }} autocomplete="off" readonly onfocus="this.removeAttribute('readonly');">
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<p class="help-block">{{ trans('admin/users/table.lock_passwords') }}</p>
|
||||
@endif
|
||||
|
||||
{!! $errors->first('email', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Company -->
|
||||
@if (\App\Models\Company::canManageUsersCompanies())
|
||||
<!-- Company -->
|
||||
<div class="form-group {{ $errors->has('company_id') ? 'has-error' : '' }}">
|
||||
<div class="col-md-3 control-label">
|
||||
{{ Form::label('company_id', trans('general.company')) }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('company_id', $company_list , Input::old('company_id', $user->company_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('company_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- language -->
|
||||
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
|
||||
<div class="col-md-8">
|
||||
{!! Form::locales('locale', Input::old('locale', $user->locale), 'select2') !!}
|
||||
{!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Employee Number -->
|
||||
<div class="form-group {{ $errors->has('employee_num') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="employee_num">{{ trans('admin/users/table.employee_num') }}</label>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="employee_num" id="employee_num" value="{{ Input::old('employee_num', $user->employee_num) }}" />
|
||||
{!! $errors->first('employee_num', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Jobtitle -->
|
||||
<div class="form-group {{ $errors->has('jobtitle') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="jobtitle">{{ trans('admin/users/table.title') }}</label>
|
||||
<div class="col-md-8">
|
||||
<input class="form-control" type="text" name="jobtitle" id="jobtitle" value="{{ Input::old('jobtitle', $user->jobtitle) }}" />
|
||||
{!! $errors->first('jobtitle', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Manager -->
|
||||
<div class="form-group {{ $errors->has('manager_id') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="manager_id">{{ trans('admin/users/table.manager') }}</label>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('manager_id', $manager_list , Input::old('manager_id', $user->manager_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('manager_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="location_id">{{ trans('admin/users/table.location') }}
|
||||
</label>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('location_id', $location_list , Input::old('location_id', $user->location_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('location_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Phone -->
|
||||
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.phone') }}</label>
|
||||
<div class="col-md-4">
|
||||
<input class="form-control" type="text" name="phone" id="phone" value="{{ Input::old('phone', $user->phone) }}" />
|
||||
{!! $errors->first('phone', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Activation Status -->
|
||||
<div class="form-group {{ $errors->has('activated') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="activated">{{ trans('admin/users/table.activated') }}</label>
|
||||
<div class="col-md-8">
|
||||
<div class="controls">
|
||||
<select{{ ($user->id === Auth::user()->id ? ' disabled="disabled"' : '') }} name="activated" id="activated" {{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}>
|
||||
@if ($user->id)
|
||||
<option value="1"{{ ($user->isActivated() ? ' selected="selected"' : '') }}>{{ trans('general.yes') }}</option>
|
||||
<option value="0"{{ ( ! $user->isActivated() ? ' selected="selected"' : '') }}>{{ trans('general.no') }}</option>
|
||||
@endif
|
||||
@else
|
||||
<option value="1"{{ (Input::old('activated') == 1 ? ' selected="selected"' : '') }}>{{ trans('general.yes') }}</option>
|
||||
<option value="0">{{ trans('general.no') }}</option>
|
||||
(Managed via LDAP)
|
||||
@endif
|
||||
|
||||
</select>
|
||||
|
||||
{!! $errors->first('activated', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notes -->
|
||||
<div class="form-group{!! $errors->has('notes') ? ' has-error' : '' !!}">
|
||||
<label for="notes" class="col-md-3 control-label">{{ trans('admin/users/table.notes') }}</label>
|
||||
<div class="col-md-8">
|
||||
<textarea class="form-control" id="notes" name="notes">{{ Input::old('notes', $user->notes) }}</textarea>
|
||||
{!! $errors->first('notes', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Groups -->
|
||||
<div class="form-group{{ $errors->has('groups') ? ' has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="groups"> {{ trans('general.groups') }}</label>
|
||||
<div class="col-md-5">
|
||||
<div class="controls">
|
||||
|
||||
<select name="groups[]" id="groups[]" multiple="multiple" class="form-control" {{ ((Config::get('app.lock_passwords') || ($user->id==Auth::user()->id) || (!Auth::user()->isSuperUser())) ? ' disabled' : '') }}>
|
||||
|
||||
@foreach ($groups as $id => $group)
|
||||
<option value="{{ $id }}"
|
||||
{{ ($userGroups->keys()->contains($id) ? ' selected="selected"' : '') }}>
|
||||
{{ $group }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="help-block">
|
||||
{{ trans('admin/users/table.groupnotes') }}
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{!! $errors->first('username', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Password -->
|
||||
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="password">
|
||||
{{ trans('admin/users/table.password') }}
|
||||
</label>
|
||||
<div class="col-md-5{{ (\App\Helpers\Helper::checkIfRequired($user, 'password')) ? ' required' : '' }}">
|
||||
@if ($user->ldap_import!='1')
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
value=""
|
||||
autocomplete="false"
|
||||
readonly
|
||||
onfocus="this.removeAttribute('readonly');"
|
||||
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
|
||||
>
|
||||
@else
|
||||
(Managed via LDAP)
|
||||
@endif
|
||||
<span id="generated-password"></span>
|
||||
{!! $errors->first('password', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@if ($user->ldap_import!='1')
|
||||
<a href="#" class="left" id="genPassword">Generate</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($user->ldap_import!='1')
|
||||
<!-- Password Confirm -->
|
||||
<div class="form-group {{ $errors->has('password_confirm') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="password_confirm">
|
||||
{{ trans('admin/users/table.password_confirm') }}
|
||||
</label>
|
||||
<div class="col-md-5 {{ ((\App\Helpers\Helper::checkIfRequired($user, 'first_name')) && (!$user->id)) ? ' required' : '' }}">
|
||||
<input
|
||||
type="password"
|
||||
name="password_confirm"
|
||||
id="password_confirm"
|
||||
class="form-control"
|
||||
value=""
|
||||
autocomplete="off"
|
||||
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
|
||||
>
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<p class="help-block">{{ trans('admin/users/table.lock_passwords') }}</p>
|
||||
@endif
|
||||
{!! $errors->first('password_confirm', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Email -->
|
||||
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="email">{{ trans('admin/users/table.email') }} </label>
|
||||
<div class="col-md-8{{ (\App\Helpers\Helper::checkIfRequired($user, 'email')) ? ' required' : '' }}">
|
||||
<input
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="email"
|
||||
id="email"
|
||||
value="{{ Input::old('email', $user->email) }}"
|
||||
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
|
||||
autocomplete="off"
|
||||
readonly
|
||||
onfocus="this.removeAttribute('readonly');"
|
||||
>
|
||||
@if (config('app.lock_passwords') && ($user->id))
|
||||
<p class="help-block">{{ trans('admin/users/table.lock_passwords') }}</p>
|
||||
@endif
|
||||
{!! $errors->first('email', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Company -->
|
||||
@if (\App\Models\Company::canManageUsersCompanies())
|
||||
<!-- Company -->
|
||||
<div class="form-group {{ $errors->has('company_id') ? 'has-error' : '' }}">
|
||||
<div class="col-md-3 control-label">
|
||||
{{ Form::label('company_id', trans('general.company')) }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('company_id', $company_list , Input::old('company_id', $user->company_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('company_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- language -->
|
||||
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
|
||||
<div class="col-md-8">
|
||||
{!! Form::locales('locale', Input::old('locale', $user->locale), 'select2') !!}
|
||||
{!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Employee Number -->
|
||||
<div class="form-group {{ $errors->has('employee_num') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="employee_num">{{ trans('admin/users/table.employee_num') }}</label>
|
||||
<div class="col-md-8">
|
||||
<input
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="employee_num"
|
||||
id="employee_num"
|
||||
value="{{ Input::old('employee_num', $user->employee_num) }}"
|
||||
/>
|
||||
{!! $errors->first('employee_num', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
<!-- Email user -->
|
||||
@if (!$user->id)
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label for="email_user">
|
||||
{{ Form::checkbox('email_user', '1', Input::old('email_user'), array('id'=>'email_user','disabled'=>'disabled')) }}
|
||||
|
||||
Email this user their credentials? <span class="help-text" id="email_user_warn">(Cannot send email. No user email address specified.)</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-pane -->
|
||||
<div class="tab-pane" id="tab_2">
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
|
||||
|
||||
@if (!Auth::user()->isSuperUser())
|
||||
<p class="alert alert-warning">Only superadmins may grant a user superadmin access.</p>
|
||||
@endif
|
||||
<!-- Jobtitle -->
|
||||
<div class="form-group {{ $errors->has('jobtitle') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="jobtitle">{{ trans('admin/users/table.title') }}</label>
|
||||
<div class="col-md-8">
|
||||
<input
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="jobtitle"
|
||||
id="jobtitle"
|
||||
value="{{ Input::old('jobtitle', $user->jobtitle) }}"
|
||||
/>
|
||||
{!! $errors->first('jobtitle', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php $counter = 1; ?>
|
||||
@foreach ($permissions as $area => $permission)
|
||||
<!-- Manager -->
|
||||
<div class="form-group {{ $errors->has('manager_id') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="manager_id">{{ trans('admin/users/table.manager') }}</label>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('manager_id', $manager_list , Input::old('manager_id', $user->manager_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('manager_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<div class="form-group {{ $errors->has('location_id') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="location_id">{{ trans('admin/users/table.location') }}
|
||||
</label>
|
||||
<div class="col-md-8">
|
||||
{{ Form::select('location_id', $location_list , Input::old('location_id', $user->location_id), array('class'=>'select2', 'style'=>'width:350px')) }}
|
||||
{!! $errors->first('location_id', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@for ($i = 0; $i < count($permission); $i++)
|
||||
<?php
|
||||
$permission_name = $permission[$i]['permission'];
|
||||
<!-- Phone -->
|
||||
<div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.phone') }}</label>
|
||||
<div class="col-md-4">
|
||||
<input class="form-control" type="text" name="phone" id="phone" value="{{ Input::old('phone', $user->phone) }}" />
|
||||
{!! $errors->first('phone', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
?>
|
||||
|
||||
@if ($counter == 2)
|
||||
<div id="nonadmin">
|
||||
@endif
|
||||
|
||||
|
||||
@if ($permission[$i]['display'])
|
||||
<h3>{{ $area }}: {{ $permission[$i]['label'] }}</h3>
|
||||
<p>{{ $permission[$i]['note'] }}</p>
|
||||
|
||||
<!-- radio -->
|
||||
<div class="form-group" style="padding-left: 15px;">
|
||||
|
||||
<label class="radio-padding">
|
||||
|
||||
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['disabled'=>'disabled']) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['class' => "$permission_name"]) }}
|
||||
@endif
|
||||
|
||||
Grant</label>
|
||||
|
||||
<label class="radio-padding">
|
||||
|
||||
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['disabled'=>'disabled']) }}
|
||||
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['class' => "$permission_name"]) }}
|
||||
|
||||
@endif
|
||||
Deny</label>
|
||||
|
||||
<label class="radio-padding">
|
||||
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['disabled'=>'disabled']) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['class' => "$permission_name"]) }}
|
||||
@endif
|
||||
|
||||
Inherit</label>
|
||||
</div>
|
||||
<hr>
|
||||
<!-- Activation Status -->
|
||||
<div class="form-group {{ $errors->has('activated') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="activated">{{ trans('admin/users/table.activated') }}</label>
|
||||
<div class="col-md-8">
|
||||
<div class="controls">
|
||||
<select
|
||||
{{ ($user->id === Auth::user()->id ? ' disabled="disabled"' : '') }}
|
||||
name="activated"
|
||||
id="activated"
|
||||
{{ ((config('app.lock_passwords') && ($user->id)) ? ' disabled' : '') }}
|
||||
>
|
||||
@if ($user->id)
|
||||
<option value="1"{{ ($user->isActivated() ? ' selected="selected"' : '') }}>{{ trans('general.yes') }}</option>
|
||||
<option value="0"{{ ( ! $user->isActivated() ? ' selected="selected"' : '') }}>{{ trans('general.no') }}</option>
|
||||
@else
|
||||
<option value="1"{{ (Input::old('activated') == 1 ? ' selected="selected"' : '') }}>{{ trans('general.yes') }}</option>
|
||||
<option value="0">{{ trans('general.no') }}</option>
|
||||
@endif
|
||||
|
||||
@endfor
|
||||
@if ($counter == count($permissions))
|
||||
|
||||
</div>
|
||||
@endif
|
||||
<?php $counter++; ?>
|
||||
@endforeach
|
||||
</select>
|
||||
{!! $errors->first('activated', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notes -->
|
||||
<div class="form-group{!! $errors->has('notes') ? ' has-error' : '' !!}">
|
||||
<label for="notes" class="col-md-3 control-label">{{ trans('admin/users/table.notes') }}</label>
|
||||
<div class="col-md-8">
|
||||
<textarea class="form-control" id="notes" name="notes">{{ Input::old('notes', $user->notes) }}</textarea>
|
||||
{!! $errors->first('notes', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Groups -->
|
||||
<div class="form-group{{ $errors->has('groups') ? ' has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="groups"> {{ trans('general.groups') }}</label>
|
||||
<div class="col-md-5">
|
||||
<div class="controls">
|
||||
<select
|
||||
name="groups[]"
|
||||
id="groups[]"
|
||||
multiple="multiple"
|
||||
class="form-control"
|
||||
{{ ((Config::get('app.lock_passwords') || ($user->id==Auth::user()->id) || (!Auth::user()->isSuperUser())) ? ' disabled' : '') }}
|
||||
>
|
||||
|
||||
@foreach ($groups as $id => $group)
|
||||
<option value="{{ $id }}"
|
||||
{{ ($userGroups->keys()->contains($id) ? ' selected="selected"' : '') }}>
|
||||
{{ $group }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<span class="help-block">
|
||||
{{ trans('admin/users/table.groupnotes') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Email user -->
|
||||
@if (!$user->id)
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-3">
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label for="email_user">
|
||||
{{ Form::checkbox('email_user', '1', Input::old('email_user'), array('id'=>'email_user','disabled'=>'disabled')) }}
|
||||
|
||||
Email this user their credentials? <span class="help-text" id="email_user_warn">(Cannot send email. No user email address specified.)</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.tab-pane -->
|
||||
|
||||
<div class="tab-pane" id="tab_2">
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
@if (!Auth::user()->isSuperUser())
|
||||
<p class="alert alert-warning">Only superadmins may grant a user superadmin access.</p>
|
||||
@endif
|
||||
</div>
|
||||
<table class="table table-striped permissions">
|
||||
<thead>
|
||||
<tr class="permissions-row">
|
||||
<th class="col-md-2"><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>
|
||||
</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-2 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',$userPermissions[$localPermission['permission'] ] == '1',['value'=>"grant"]) }}
|
||||
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio('permission['.$localPermission['permission'].']', '-1',$userPermissions[$localPermission['permission'] ] == '-1',['value'=>"deny"]) }}
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio('permission['.$localPermission['permission'].']','0',$userPermissions[$localPermission['permission'] ] == '0',['value'=>"inherit"] ) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@else
|
||||
<tbody class="permissions-group">
|
||||
<tr class="header-row permissions-row">
|
||||
<td class="col-md-2 header-name">
|
||||
<h3>{{ $area }}</h3>
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '1',false,['value'=>"grant"]) }}
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '-1',false,['value'=>"deny"]) }}
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '0',false,['value'=>"inherit"] ) }}
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($permissionsArray as $index => $permission)
|
||||
<tr class="permissions-row">
|
||||
@if ($permission['display'])
|
||||
<td
|
||||
class="col-md-2 tooltip-base permissions-item"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="{{ $permission['note'] }}"
|
||||
>
|
||||
{{ $permission['label'] }}
|
||||
</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']) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[ $permission['permission'] ] == '1', ["value"=>"grant"]) }}
|
||||
@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']) }}
|
||||
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny"]) }}
|
||||
@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']) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit"]) }}
|
||||
@endif
|
||||
</td>
|
||||
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
</div><!-- /.tab-pane -->
|
||||
</div><!-- /.tab-content -->
|
||||
<div class="box-footer text-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
</div><!-- nav-tabs-custom -->
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@section('moar_scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
@ -390,6 +500,19 @@ $(document).ready(function() {
|
|||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('tr.header-row input:radio').click(function() {
|
||||
value = $(this).attr('value');
|
||||
$(this).parent().parent().siblings().each(function() {
|
||||
$(this).find('td input:radio[value='+value+']').prop("checked", true);
|
||||
})
|
||||
});
|
||||
|
||||
$('.header-name').click(function() {
|
||||
$(this).parent().nextUntil('tr.header-row').slideToggle(500);
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('assets/js/pGenerator.jquery.js') }}"></script>
|
||||
|
||||
<script>
|
||||
|
@ -397,6 +520,7 @@ $(document).ready(function() {
|
|||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('.tooltip-base').tooltip({container: 'body'})
|
||||
$(".superuser").change(function() {
|
||||
var perms = $(this).val();
|
||||
if (perms =='1') {
|
||||
|
@ -422,5 +546,3 @@ $(document).ready(function(){
|
|||
});
|
||||
</script>
|
||||
@stop
|
||||
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue