mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-21 18:39:31 +00:00
Check permissions for time travel and element undo.
This commit is contained in:
parent
254d4e6c69
commit
8a61b465d0
23 changed files with 370 additions and 90 deletions
|
|
@ -57,11 +57,11 @@ class UserVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof User) {
|
||||
if (is_a($subject, User::class, true)) {
|
||||
return in_array($attribute, array_merge(
|
||||
$this->resolver->listOperationsForPermission('users'),
|
||||
$this->resolver->listOperationsForPermission('self')),
|
||||
false
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -89,10 +89,11 @@ class UserVoter extends ExtendedVoter
|
|||
return $tmp;
|
||||
}
|
||||
}
|
||||
//Else just check users permission:
|
||||
if ($this->resolver->isValidOperation('users', $attribute)) {
|
||||
return $this->resolver->inherit($user, 'users', $attribute) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
//Else just check users permission:
|
||||
if ($this->resolver->isValidOperation('users', $attribute)) {
|
||||
return $this->resolver->inherit($user, 'users', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue