Skip to content

Commit

Permalink
fix patching rights
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarzin committed Dec 8, 2024
1 parent 08b5c9b commit 49b95d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/PatchingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PatchingController extends Controller
{
public function index(Request $request)
{
abort_if(Gate::denies('patching_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
abort_if(Gate::denies('patching_show'), Response::HTTP_FORBIDDEN, '403 Forbidden');

// Get Attributes
$attributes_list = $this->getAttributes();
Expand Down
15 changes: 15 additions & 0 deletions resources/views/admin/roles/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,21 @@
</div>
</div>

<div class="col-md-2">
<div class="form-check">
<label>{{ trans('cruds.tools.patching') }}</label>
@php($permission = $permissions_sorted['patching'])
<div class="form-switch form-switch-lg">
<input class="form-check-input" type="checkbox" name="permissions[]" data-check="{{ $permission['name'] }}" id="perm_{{ $permission['actions'][0][0] }}" value="{{ $permission['actions'][0][0] }}" {{ in_array($permission['actions'][0][0], old('permissions', [])) || $role->permissions->contains($permission['actions'][0][0]) ? 'checked' : '' }}>
<label class="form-check-label" for="for_{{ $permission['actions'][0][0] }}">{{ $permission['actions'][0][1] }}</label>
</div>
<div class="form-switch form-switch-lg">
<input class="form-check-input" type="checkbox" name="permissions[]" data-check="{{ $permission['name'] }}" id="perm_{{ $permission['actions'][1][0] }}" value="{{ $permission['actions'][1][0] }}" {{ in_array($permission['actions'][1][0], old('permissions', [])) || $role->permissions->contains($permission['actions'][1][0]) ? 'checked' : '' }}>
<label class="form-check-label" for="for_{{ $permission['actions'][1][0] }}">{{ $permission['actions'][1][1] }}</label>
</div>
</div>
</div>

</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/admin.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
{{ trans('panel.menu.tools') }}
</a>
<div class="dropdown-menu">
@can('patching_access')
@can('patching_show')
<a class="dropdown-item" href="/admin/patching/index">
<i class="fa-fw fas fa-wrench"></i>
{{ trans('panel.menu.patching') }}
Expand Down

0 comments on commit 49b95d2

Please sign in to comment.