Skip to content

A free open source IT asset/license management system

Moved the logic into the permissions partial, added translations

snipec3b5c4dfaea0
diff --git a/config/permissions.php b/config/permissions.php
index 3151cdd539..28be842279 100644
--- a/config/permissions.php
+++ b/config/permissions.php
@@ -448,11 +448,6 @@ return [
'User (Self) Accounts' => [
- [
- // This isn't really a permission, but we include it for now
- 'permission' => 'self.view',
- 'display' => false,
- ],
[
'permission' => 'self.two_factor',
'display' => true,
diff --git a/resources/lang/en-US/permissions.php b/resources/lang/en-US/permissions.php
index ab55195ac4..5ed9bc2f31 100644
--- a/resources/lang/en-US/permissions.php
+++ b/resources/lang/en-US/permissions.php
@@ -413,4 +413,12 @@ return array(
'name' => 'Create Depreciation Records',
],
+ 'grant_all' => 'Grant all permissions for :area',
+ 'deny_all' => 'Deny all permissions for :area',
+ 'inherit_all' => 'Inherit all permissions for :area from permission groups',
+ 'grant' => 'Grant Permission for :area',
+ 'deny' => 'Deny Permission for :area',
+ 'inherit' => 'Inherit Permission for :area from permission groups',
+ 'use_groups' => 'We strongly suggest using Permission Groups instead of assigning individual permissions for easier management.'
+
);
diff --git a/resources/views/groups/edit.blade.php b/resources/views/groups/edit.blade.php
index cb451418f7..c562a6263c 100755
--- a/resources/views/groups/edit.blade.php
+++ b/resources/views/groups/edit.blade.php
@@ -72,177 +72,9 @@
</div>
-<style>
- .slider-wrapper {
- display: flex;
- padding: 2px;
- background-color: #e9e9e9;
- margin-bottom: 3px;
- border-radius: 4px;
- border: 1px #d6d6d6 solid;
- }
-
- .custom-input {
- flex-grow: 1;
- }
-
- .custom-input input[type=radio] {
- display: none;
- }
-
- .custom-input label {
- display: block;
- margin-bottom: 0px;
- padding: 6px 8px;
- color: #fff;
- font-weight: bold;
- text-align: center;
- transition : all .4s 0s ease;
- cursor: pointer;
- }
-
- .custom-input label {
- color: #9a9999;
- border-radius: 4px;
- }
-
- .custom-input .allow:checked + label {
- background-color: green;
- color: white;
- border-radius: 4px;
- }
-
- .custom-input .deny:checked + label {
- background-color: #a94442;
- color: white;
- border-radius: 4px;
- }
-
- .custom-input .allow:checked + label {
- background-color: green;
- color: white;
- border-radius: 4px;
- }
-</style>
<div class="col-md-12">
- @foreach ($permissions as $area => $area_permission)
- <!-- handle superadmin and reports, and anything else with only one option -->
- @php
- $localPermission = $area_permission[0];
- @endphp
- <div class="form-group{{ ($localPermission['permission']!='superuser') ? ' nonsuperuser' : '' }}{{ ( ($localPermission['permission']!='superuser') && ($localPermission['permission']!='admin')) ? ' nonadmin' : '' }}">
- <div class="callout callout-legend col-md-12">
- <div class="col-md-10">
- <h4>
- {{ trans('permissions.'.str_slug($area).'.name') }}
- </h4>
-
- @if (\Lang::has('permissions.'.str_slug($area).'.note'))
- <p>{{ trans('permissions.'.str_slug($area).'.note') }}</p>
- @endif
-
-
- </div>
-
- <!-- Handle the checkall ALLOW and DENY radios -->
- <div class="col-md-2 text-right header-row">
- <div class="slider-wrapper">
- <div class="custom-input"{!! (count($area_permission) > 1) ? ' data-tooltip="true" title="Grant All Permissions for '.$area.'"' : '' !!}>
- <input
- class="form-control {{ str_slug($area) }} allow"
- data-checker-group="{{ str_slug($area) }}"
- aria-label="{{ str_slug($area) }}"
- name="permission[{{ str_slug($area) }}]"
- @checked(array_key_exists(str_slug($area), $groupPermissions) && $groupPermissions[str_slug($area)] == '1')
- type="radio"
- value="1"
- id="{{ str_slug($area) }}_allow"
- >
-
- <label class="allow" for="{{ str_slug($area) }}_allow">
- <i class="fa-solid fa-square-check"></i>
- </label>
-
- </div>
- <div class="custom-input"{!! (count($area_permission) > 1) ? ' data-tooltip="true" title="Deny All for '.$area.'"' : '' !!}>
-
- <input
- class="form-control {{ str_slug($area) }} deny"
- data-checker-group="{{ str_slug($area) }}"
- aria-label="{{ str_slug($area) }}"
- name="permission[{{ str_slug($area) }}]"
- @checked(array_key_exists(str_slug($area), $groupPermissions) && $groupPermissions[str_slug($area)] == '0')
- type="radio"
- value="0"
- id="{{ str_slug($area) }}_deny"
- >
-
- <label class="deny" for="{{ str_slug($area) }}_deny">
- <i class="fa-solid fa-square-xmark"></i>
- </label>
-
- </div>
- </div>
- </div>
-
- </div>
- </div>
- @if (count($area_permission) > 1)
-
- @foreach ($area_permission as $index => $this_permission)
- @if ($this_permission['display'])
-
- <div class="{{ ($localPermission['permission']!='superuser') ? ' nonsuperuser' : '' }}{{ ( ($localPermission['permission']!='superuser') && ($localPermission['permission']!='admin')) ? ' nonadmin' : '' }}">
- <div class="form-group" style="border-bottom: 1px solid #eee; padding-right: 9px;">
- <div class="col-md-10">
- <strong>{{ trans('permissions.'.str_slug($this_permission['permission']).'.name') }}</strong>
- @if (\Lang::has('permissions.'.str_slug($this_permission['permission']).'.note'))
- <p>{{ trans('permissions.'.str_slug($this_permission['permission']).'.note') }}</p>
- @endif
- </div>
-
- <div class="form-group col-md-2 text-right">
- <div class="slider-wrapper">
- <div class="custom-input" data-tooltip="true" title="Allow">
- <input
- class="radiochecker-{{ str_slug($area) }} allow"
- aria-label="permission[{{ $this_permission['permission'] }}]"
- @checked(array_key_exists($this_permission['permission'], $groupPermissions) && $groupPermissions[$this_permission['permission']] == '1')
- name="permission[{{ $this_permission['permission'] }}]"
- type="radio"
- id="{{ str_slug($this_permission['permission']) }}_allow"
- value="1"
- >
- <label for="{{ str_slug($this_permission['permission']) }}_allow" class="allow">
- <i class="fa-solid fa-square-check"></i>
- </label>
- </div>
- <div class="custom-input" data-tooltip="true" title="Deny">
- <input
- class="form-control deny radiochecker-{{ str_slug($area) }}"
- aria-label="permission[{{ $this_permission['permission'] }}]"
- @checked(array_key_exists($this_permission['permission'], $groupPermissions) && $groupPermissions[$this_permission['permission']] == '0')
- name="permission[{{ $this_permission['permission'] }}]"
- type="radio"
- value="0"
- id="{{ str_slug($this_permission['permission']) }}_deny"
- >
- <label for="{{ str_slug($this_permission['permission']) }}_deny">
- <i class="fa-solid fa-square-xmark"></i>
- </label>
- </div>
- </div>
- </div>
-
-
- </div>
- </div>
- @endif
- @endforeach
- @endif
-
- @endforeach
+ @include ('partials.forms.edit.permissions-base', ['use_inherit' => false])
</div>
@stop
diff --git a/resources/views/partials/forms/edit/permissions-base.blade.php b/resources/views/partials/forms/edit/permissions-base.blade.php
index ad166888c7..1899f0e269 100644
--- a/resources/views/partials/forms/edit/permissions-base.blade.php
+++ b/resources/views/partials/forms/edit/permissions-base.blade.php
@@ -1,202 +1,233 @@
-@foreach ($permissions as $area => $permissionsArray)
- @if (count($permissionsArray) == 1)
- <?php $localPermission = $permissionsArray[0]; ?>
- <tbody class="permissions-group">
- <tr class="header-row permissions-row">
- <td class="col-md-5 tooltip-base permissions-item"
- data-tooltip="true"
- data-placement="right"
- title="{{ $localPermission['note'] }}"
- >
- @unless (empty($localPermission['label']))
- <h2>{{ $area . ': ' . $localPermission['label'] }}</h2>
- @else
- <h2>{{ $area }}</h2>
- @endunless
- </td>
-
- <td class="col-md-1 permissions-item">
- <label class="sr-only" for="{{ 'permission['.$localPermission['permission'].']' }}">{{ 'permission['.$localPermission['permission'].']' }}</label>
- @if (($localPermission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="1"
- />
- @elseif (($localPermission['permission'] == 'admin') && (!Auth::user()->hasAccess('admin')))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="1"
- />
- @else
- <input
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="1"
- />
- @endif
+<style>
+ .radio-toggle-wrapper {
+ display: flex;
+ padding: 2px;
+ background-color: #e9e9e9;
+ margin-bottom: 3px;
+ border-radius: 4px;
+ border: 1px #d6d6d6 solid;
+ }
-
- </td>
- <td class="col-md-1 permissions-item">
- <label class="sr-only" for="{{ 'permission['.$localPermission['permission'].']' }}">{{ 'permission['.$localPermission['permission'].']' }}</label>
- @if (($localPermission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '-1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="-1"
- />
- @elseif (($localPermission['permission'] == 'admin') && (!Auth::user()->hasAccess('admin')))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '-1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="-1"
- />
- @else
- <input
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '-1')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="-1"
- />
- @endif
- </td>
- <td class="col-md-1 permissions-item">
- <label class="sr-only" for="{{ 'permission['.$localPermission['permission'].']' }}">
- {{ 'permission['.$localPermission['permission'].']' }}</label>
- @if (($localPermission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '0')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="0"
- />
- @elseif (($localPermission['permission'] == 'admin') && (!Auth::user()->hasAccess('admin')))
- <input
- disabled="disabled"
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '0')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="0"
- />
- @else
- <input
- aria-label="permission[{{ $localPermission['permission'] }}]"
- @checked($userPermissions[$localPermission['permission']] == '0')
- name="permission[{{ $localPermission['permission'] }}]"
- type="radio"
- value="0"
- />
+ .radio-slider-inputs {
+ flex-grow: 1;
+ }
+
+ .radio-slider-inputs input[type=radio] {
+ display: none;
+ }
+
+ .radio-slider-inputs label {
+ display: block;
+ margin-bottom: 0px;
+ padding: 6px 8px;
+ color: #fff;
+ font-weight: bold;
+ text-align: center;
+ transition : all .4s 0s ease;
+ cursor: pointer;
+ }
+
+ .radio-slider-inputs label {
+ color: #9a9999;
+ border-radius: 4px;
+ }
+
+ .radio-slider-inputs .allow:checked + label {
+ background-color: green;
+ color: white;
+ border-radius: 4px;
+ }
+
+ .radio-slider-inputs .inherit:checked + label {
+ background-color: #f6f4f4;
+ border: 1px #d6d6d6 solid;
+ color: #9a9999;
+ border-radius: 4px;
+ }
+
+ .radio-slider-inputs .deny:checked + label {
+ background-color: #a94442;
+ color: white;
+ border-radius: 4px;
+ }
+
+ .radio-slider-inputs .allow:checked + label {
+ background-color: green;
+ color: white;
+ border-radius: 4px;
+ }
+</style>
+
+
+@foreach ($permissions as $area => $area_permission)
+
+ <!-- handle superadmin and reports, and anything else with only one option -->
+ @php
+ $localPermission = $area_permission[0];
+ @endphp
+ <div class="form-group{{ ($localPermission['permission']!='superuser') ? ' nonsuperuser' : '' }}{{ ( ($localPermission['permission']!='superuser') && ($localPermission['permission']!='admin')) ? ' nonadmin' : '' }}">
+ <div class="callout callout-legend col-md-12">
+ <div class="col-md-10">
+ <h4>
+ {{ trans('permissions.'.str_slug($area).'.name') }}
+ </h4>
+
+ @if (\Lang::has('permissions.'.str_slug($area).'.note'))
+ <p>{{ trans('permissions.'.str_slug($area).'.note') }}</p>
@endif
- </td>
- </tr>
- </tbody>
-
- @else <!-- count($permissionsArray) == 1-->
- <tbody class="permissions-group">
- <tr class="header-row permissions-row">
- <td class="col-md-5 header-name">
- <h2> {{ $area }}</h2>
- </td>
- <td class="col-md-1 permissions-item">
- <label for="{{ $area }}" class="sr-only">{{ $area }}</label>
- <input
- value="1"
- data-checker-group="{{ str_slug($area) }}"
- aria-label="{{ $area }}"
- name="{{ $area }}"
- type="radio"
- />
- </td>
- <td class="col-md-1 permissions-item">
- <label for="{{ $area }}" class="sr-only">{{ $area }}</label>
- <input
- value="-1"
- data-checker-group="{{ str_slug($area) }}"
- aria-label="{{ $area }}"
- name="{{ $area }}"
- type="radio"
- />
- </td>
- <td class="col-md-1 permissions-item">
- <label for="{{ $area }}" class="sr-only">{{ $area }}</label>
- <input
- value="0"
- data-checker-group="{{ str_slug($area) }}"
- aria-label="{{ $area }}"
- name="{{ $area }}"
- type="radio"
- />
- </td>
- </tr>
-
- @foreach ($permissionsArray as $index => $permission)
- <tr class="permissions-row">
- @if ($permission['display'])
- <td
- class="col-md-5 tooltip-base permissions-item"
- data-tooltip="true"
- data-placement="right"
- title="{{ $permission['note'] }}"
- >
- {{ $permission['label'] }}
- </td>
- <td class="col-md-1 permissions-item">
- <label class="sr-only" for="{{ 'permission['.$permission['permission'].']' }}">{{ 'permission['.$permission['permission'].']' }}</label>
- <input
- value="1"
- class="radiochecker-{{ str_slug($area) }}"
- aria-label="permission[{{ $permission['permission'] }}]"
- @checked($userPermissions[$permission['permission']] == '1')
- @disabled(($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- name="permission[{{ $permission['permission'] }}]"
- type="radio"
- />
- </td>
- <td class="col-md-1 permissions-item">
+
+
+ </div>
+
+ <!-- Handle the checkall ALLOW and DENY radios -->
+ <div class="col-md-2 text-right header-row">
+ <div class="radio-toggle-wrapper">
+ <div class="radio-slider-inputs" data-tooltip="true" title="{{ (count($area_permission) > 1) ? trans('permissions.grant_all', ['area' => $area]) : trans('permissions.grant', ['area' => $area]) }}">
<input
- value="-1"
- class="radiochecker-{{ str_slug($area) }}"
- aria-label="permission[{{ $permission['permission'] }}]"
- @checked($userPermissions[$permission['permission']] == '-1')
- @disabled(($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- name="permission[{{ $permission['permission'] }}]"
- type="radio"
- />
- </td>
- <td class="col-md-1 permissions-item">
+ class="form-control {{ str_slug($area) }} allow"
+ data-checker-group="{{ str_slug($area) }}"
+ aria-label="{{ str_slug($area) }}"
+ name="permission[{{ str_slug($area) }}]"
+ @checked(array_key_exists(str_slug($area), $groupPermissions) && $groupPermissions[str_slug($area)] == '1')
+ type="radio"
+ value="1"
+ {{-- Disable the superuser and admin allow if the user is not a superuser --}}
+ @if (((str_slug($area) == 'admin') && (!auth()->user()->hasAccess('admin'))) || ((str_slug($area) == 'superuser') && (!auth()->user()->isSuperUser())))
+ disabled
+ @endif
+ id="{{ str_slug($area) }}_allow"
+ >
+
+ <label class="allow" for="{{ str_slug($area) }}_allow">
+ <i class="fa-solid fa-square-check"></i>
+ </label>
+ </div>
+
+
+ @if ($use_inherit)
+ <div class="radio-slider-inputs"data-tooltip="true" title="{{ (count($area_permission) > 1) ? trans('permissions.inherit_all', ['area' => $area]) : trans('permissions.inherit', ['area' => $area]) }}">
+ <input
+ class="form-control {{ str_slug($area) }} inherit"
+ data-checker-group="{{ str_slug($area) }}"
+ aria-label="{{ str_slug($area) }}"
+ name="permission[{{ str_slug($area) }}]"
+ @checked(array_key_exists(str_slug($area), $groupPermissions) && $groupPermissions[str_slug($area)] == '-1')
+ type="radio"
+ value="-1"
+ {{-- Disable the superuser and admin allow if the user is not a superuser --}}
+ @if (((str_slug($area) == 'admin') && (!auth()->user()->hasAccess('admin'))) || ((str_slug($area) == 'superuser') && (!auth()->user()->isSuperUser())))
+ disabled
+ @endif
+ id="{{ str_slug($area) }}_inherit"
+ >
+
+ <label class="inherit" for="{{ str_slug($area) }}_inherit">
+ <i class="fa-solid fa-layer-group"></i>
+ </label>
+ </div>
+
+ @endif
+
+ <div class="radio-slider-inputs" data-tooltip="true" title="{{ (count($area_permission) > 1) ? trans('permissions.deny_all', ['area' => $area]) : trans('permissions.deny', ['area' => $area]) }}">
<input
- value="0"
- class="radiochecker-{{ str_slug($area) }}"
- aria-label="permission[{{ $permission['permission'] }}]"
- @checked($userPermissions[$permission['permission']] =='0')
- @disabled(($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
- name="permission[{{ $permission['permission'] }}]"
- type="radio"
- />
- </td>
- @endif
- </tr>
+ class="form-control {{ str_slug($area) }} deny"
+ data-checker-group="{{ str_slug($area) }}"
+ aria-label="{{ str_slug($area) }}"
+ name="permission[{{ str_slug($area) }}]"
+ @checked(array_key_exists(str_slug($area), $groupPermissions) && $groupPermissions[str_slug($area)] == '0')
+ type="radio"
+ value="0"
+ {{-- Disable the superuser and admin allow if the user is not a superuser --}}
+ @if (((str_slug($area) == 'admin') && (!auth()->user()->hasAccess('admin'))) || ((str_slug($area) == 'superuser') && (!auth()->user()->isSuperUser())))
+ disabled
+ @endif
+ id="{{ str_slug($area) }}_deny"
+ >
+
+ <label class="deny" for="{{ str_slug($area) }}_deny">
+ <i class="fa-solid fa-square-xmark"></i>
+ </label>
+ </div>
+
+ </div>
+ </div>
+
+ </div>
+ </div>
+ @if (count($area_permission) > 1)
+
+ @foreach ($area_permission as $index => $this_permission)
+ @if ($this_permission['display'])
+ @php
+ $section_translation = trans('permissions.'.str_slug($this_permission['permission']).'.name');
+ @endphp
+ <div class="{{ ($localPermission['permission']!='superuser') ? ' nonsuperuser' : '' }}{{ ( ($localPermission['permission']!='superuser') && ($localPermission['permission']!='admin')) ? ' nonadmin' : '' }}">
+ <div class="form-group" style="border-bottom: 1px solid #eee; padding-right: 9px;">
+ <div class="col-md-10">
+ <strong>{{ $section_translation }}</strong>
+ @if (\Lang::has('permissions.'.str_slug($this_permission['permission']).'.note'))
+ <p>{{ trans('permissions.'.str_slug($this_permission['permission']).'.note') }}</p>
+ @endif
+ </div>
+
+ <div class="form-group col-md-2 text-right">
+ <div class="radio-toggle-wrapper">
+ <div class="radio-slider-inputs" data-tooltip="true" title="{{ trans('permissions.grant', ['area' => $section_translation]) }}">
+ <input
+ class="form-control allow radiochecker-{{ str_slug($area) }}"
+ aria-label="permission[{{ $this_permission['permission'] }}]"
+ @checked(array_key_exists($this_permission['permission'], $groupPermissions) && $groupPermissions[$this_permission['permission']] == '1')
+ name="permission[{{ $this_permission['permission'] }}]"
+ type="radio"
+ id="{{ str_slug($this_permission['permission']) }}_allow"
+ value="1"
+ >
+ <label for="{{ str_slug($this_permission['permission']) }}_allow" class="allow">
+ <i class="fa-solid fa-square-check"></i>
+ </label>
+ </div>
+
+ @if ($use_inherit)
+ <div class="radio-slider-inputs" data-tooltip="true" title="{{ trans('permissions.inherit', ['area' => $section_translation]) }}">
+ <input
+ class="form-control inherit radiochecker-{{ str_slug($area) }}"
+ aria-label="permission[{{ $this_permission['permission'] }}]"
+ @checked(array_key_exists($this_permission['permission'], $groupPermissions) && $groupPermissions[$this_permission['permission']] == '-1')
+ name="permission[{{ $this_permission['permission'] }}]"
+ type="radio"
+ id="{{ str_slug($this_permission['permission']) }}_inherit"
+ value="-1"
+ >
+ <label for="{{ str_slug($this_permission['permission']) }}_inherit" class="inherit">
+ <i class="fa-solid fa-layer-group"></i>
+ </label>
+ </div>
+ @endif
+
+ <div class="radio-slider-inputs" data-tooltip="true" title="{{ trans('permissions.deny', ['area' => $section_translation]) }}">
+ <input
+ class="form-control deny radiochecker-{{ str_slug($area) }}"
+ aria-label="permission[{{ $this_permission['permission'] }}]"
+ @checked(array_key_exists($this_permission['permission'], $groupPermissions) && $groupPermissions[$this_permission['permission']] == '0')
+ name="permission[{{ $this_permission['permission'] }}]"
+ type="radio"
+ value="0"
+ id="{{ str_slug($this_permission['permission']) }}_deny"
+ >
+ <label for="{{ str_slug($this_permission['permission']) }}_deny">
+ <i class="fa-solid fa-square-xmark"></i>
+ </label>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+ </div>
+ @endif
@endforeach
- </tbody>
@endif
+
@endforeach
+
+
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php
index 54f754b9b9..26c3f39d65 100755
--- a/resources/views/users/edit.blade.php
+++ b/resources/views/users/edit.blade.php
@@ -29,38 +29,7 @@
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 {
- border: 1px solid;
- }
-
- .header-row {
- border-bottom: 1px solid #ccc;
- }
-
- .permissions-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .table > tbody > tr > td.permissions-item {
- padding: 1px;
- padding-left: 8px;
- }
- .header-name {
- cursor: pointer;
- }
</style>
@@ -663,27 +632,24 @@
@can('admin')
<div class="tab-pane" id="permissions">
- <div class="col-md-12">
- @if (!Auth::user()->isSuperUser())
- <p class="alert alert-warning">{{ trans('admin/users/general.superadmin_permission_warning') }}</p>
- @endif
-
- @if (!Auth::user()->hasAccess('admin'))
- <p class="alert alert-warning">{{ trans('admin/users/general.admin_permission_warning') }}</p>
- @endif
- </div>
+ @if (!Auth::user()->isSuperUser())
+ <p class="alert alert-warning">{{ trans('admin/users/general.superadmin_permission_warning') }}</p>
+ @endif
+
+ @if (!Auth::user()->hasAccess('admin'))
+ <p class="alert alert-warning">{{ trans('admin/users/general.admin_permission_warning') }}</p>
+ @endif
+
+ <p class="alert alert-info">
+ {{ trans('permissions.use_groups') }}
+ </p>
+
+ <div class="col-md-12">
+ @include('partials.forms.edit.permissions-base', ['use_inherit' => true, 'groupPermissions' => $userPermissions])
+ </div>
+
+
- <table class="table table-striped permissions">
- <thead>
- <tr class="permissions-row">
- <th class="col-md-5">{{ trans('admin/groups/titles.permission') }}</th>
- <th class="col-md-1">{{ trans('admin/groups/titles.grant') }}</th>
- <th class="col-md-1">{{ trans('admin/groups/titles.deny') }}</th>
- <th class="col-md-1">{{ trans('admin/users/table.inherit') }}</th>
- </tr>
- </thead>
- @include('partials.forms.edit.permissions-base')
- </table>
</div><!-- /.tab-pane -->
@endcan
</div><!-- /.tab-content -->
@@ -815,6 +781,56 @@ $(document).ready(function() {
});
});
+ if ($("#superuser_allow").is(':checked')) {
+ // alert('superuser is checked on page load');
+
+ // Hide here instead of fadeout on pageload to prevent what looks like Flash Of Unstyled Content (FOUC)
+ $(".nonsuperuser").hide();
+ $(".nonsuperuser").attr('display','none');
+ }
+
+
+ $(".superuser").change(function() {
+ if ($(this).val() == '1') {
+ $(".nonsuperuser").fadeOut();
+ $(".nonsuperuser").attr('display','none');
+ $(".nonadmin").fadeOut();
+ $(".nonadmin").attr('display','none');
+ } else if ($(this).val() == '0') {
+ $(".nonsuperuser").fadeIn();
+ $(".nonsuperuser").attr('display','block');
+ }
+ });
+
+
+
+ if ($("#admin_allow").is(':checked')) {
+ // alert('admin is checked on page load');
+
+ // Hide here instead of fadeout on pageload to prevent what looks like Flash Of Unstyled Content (FOUC)
+ $(".nonadmin").hide();
+ $(".nonadmin").attr('display','none');
+ }
+
+ $(".admin").change(function() {
+ if ($(this).val() == '1') {
+ $(".nonadmin").fadeOut();
+ $(".nonadmin").attr('display','none');
+ } else if ($(this).val() == '0') {
+ $(".nonadmin").fadeIn();
+ $(".nonadmin").attr('display','block');
+ }
+ });
+
+
+ // Check/Uncheck all radio buttons in the group
+ $('.header-row input:radio').change(function() {
+ value = $(this).attr('value');
+ area = $(this).data('checker-group');
+ $('.radiochecker-'+area+'[value='+value+']').prop('checked', true);
+ });
+
+
});
</script>