mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-31 16:24:54 +02: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
|
@ -58,11 +58,7 @@ class AttachmentVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof Attachment) {
|
||||
return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,10 +71,11 @@ class AttachmentVoter extends ExtendedVoter
|
|||
*/
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Attachment) {
|
||||
if (is_a($subject, Attachment::class, true)) {
|
||||
return in_array($attribute, $this->resolver->listOperationsForPermission('parts_attachments'), false);
|
||||
}
|
||||
|
||||
//Allow class name as subject
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue