mirror of
https://github.com/snipe/snipe-it.git
synced 2026-02-05 02:35:24 +00:00
Warn if user has individual permission overrides
This commit is contained in:
@ -224,6 +224,24 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasIndividualPermissions() {
|
||||
|
||||
if (is_object($this->permissions)) {
|
||||
$permissions = json_decode(json_encode($this->permissions), true);
|
||||
}
|
||||
|
||||
if (is_string($this->permissions)) {
|
||||
$permissions = json_decode($this->permissions, true);
|
||||
}
|
||||
|
||||
foreach ($permissions as $permission) {
|
||||
if ($permission != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internally check the user permission for the given section
|
||||
*
|
||||
|
||||
@ -426,17 +426,19 @@
|
||||
<div class="col-md-9">
|
||||
@if ($user->groups->count() > 0)
|
||||
@foreach ($user->groups as $group)
|
||||
|
||||
@can('superadmin')
|
||||
<a href="{{ route('groups.show', $group->id) }}" class="label label-default">{{ $group->name }}</a>
|
||||
@else
|
||||
{{ $group->name }}
|
||||
@endcan
|
||||
|
||||
@endforeach
|
||||
@else
|
||||
--
|
||||
@endif
|
||||
|
||||
@if ($user->hasIndividualPermissions())
|
||||
<span class="text-warning"><x-icon type="warning" />This user has at least one individual permission set.</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user