diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 2df31e20..041bebd7 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -106,7 +106,7 @@ class AttachmentFormType extends AbstractType 'required' => false, 'label' => 'attachment.edit.secure_file', 'mapped' => false, - 'disabled' => !$this->security->isGranted('@parts_attachments.show_private'), + 'disabled' => !$this->security->isGranted('@attachments.show_private'), 'help' => 'attachment.edit.secure_file.help', ]); diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index b5b7b7ba..16d9e5b9 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -56,7 +56,7 @@ class AttachmentVoter extends ExtendedVoter */ protected function voteOnUser(string $attribute, $subject, User $user): bool { - return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false; + return $this->resolver->inherit($user, 'attachments', $attribute) ?? false; } /** @@ -70,7 +70,7 @@ class AttachmentVoter extends ExtendedVoter protected function supports(string $attribute, $subject): bool { if (is_a($subject, Attachment::class, true)) { - return in_array($attribute, $this->resolver->listOperationsForPermission('parts_attachments'), false); + return in_array($attribute, $this->resolver->listOperationsForPermission('attachments'), false); } //Allow class name as subject diff --git a/src/Security/Voter/PermissionVoter.php b/src/Security/Voter/PermissionVoter.php index 86ca99f2..729b5cfd 100644 --- a/src/Security/Voter/PermissionVoter.php +++ b/src/Security/Voter/PermissionVoter.php @@ -83,7 +83,9 @@ class PermissionVoter extends ExtendedVoter $valid = $this->resolver->isValidOperation($perm, $op); //if an invalid operation is encountered, throw an exception so the developer knows it - //throw new \RuntimeException('Encountered invalid permission operation "'.$op.'" for permission "'.$perm.'"!'); + if(!$valid) { + throw new \RuntimeException('Encountered invalid permission operation "'.$op.'" for permission "'.$perm.'"!'); + } return true; }