Behavior of required rights when saving, copying and restoring pages

Hi everyone,

at the moment, when creating or updating a document, a listener to UserCreatingDocumentEvent and UserUpdatingDocumentEvent cancels saving when the user doesn’t have the specified rights and required rights are enforced.

This is basically a protection against users setting rights they don’t have, which is an important protection. However, I have the impression this might have unintended consequences, like when a user (or some code) manually specifies a template - for the template selection in UI, templates that require and enforce rights that the user doesn’t have are already excluded.

Further, I noticed some not-so-intuitive behavior when copying and restoring pages. Therefore, I propose the following changes related to required rights:

Proposal 1: Undo changes to required rights on saving

I propose that similar to saving rights, when a user tries saving with required rights the user doesn’t have, those rights are reset to the previous version of the page instead of cancelling saving. This still doesn’t allow removing a required right from a page as the user wouldn’t be able to edit the page in this case.

We can also have the case that enforcing is enabled compared to the previous version, but the required rights object was already present with a right that the user doesn’t have. I suggest that in this case, we remove the required right object and don’t undo the enforcing. The idea of this is to keep the enforcing state as much as possible.

Proposal 2: Handling of required rights when copying and restoring pages

I thought that the aforementioned listener would prevent copying or restoring pages that have required rights enforced that the current user doesn’t have. I tested it, and it turns out that I was wrong. While the current user becomes the author of the page and breaks the page’s content, the required right is still enforced. This means that the user who copied the page cannot edit the page after copying. The user can still delete and then restore the page, though afterward, the user still cannot edit the page.

To me, this is bad usability. Instead of copying the page using the built-in copy (or restore) method, the user could always just create a new page with the same contents but without the required rights. So why do we make it that complicated? I suggest that when copying or restoring a page that has required rights that the current user doesn’t have, we remove those rights (but keep the enforcing state). It will still break the page, but at least the user can edit the page and remove the broken content.

I’m also wondering if for copying pages at least, we shouldn’t keep the original author, but it would make the change I’ve just described a bit strange.

Thank you very much for your feedback!