Skip to content

🐛(backend) fix restricted folders deletion, move and inheritance - #945

Open
kernicPanel wants to merge 6 commits into
mainfrom
fix/restriction
Open

kernicPanel wants to merge 6 commits into
mainfrom
fix/restriction

Conversation

@kernicPanel

Copy link
Copy Markdown
Collaborator

Purpose

Acceptance testing of restricted folders turned up a set of backend bugs
around deletion, trash, move and access inheritance of the restriction
entries and their target folders.

Proposal

A restricted folder that loses its place in the parent tree becomes a
plain root folder. Who performs the action decides what happens to it.

  • Deleting the restriction entry as owner of the restricted folder
    trashes the folder itself, once, instead of leaving it at the root
  • Trashing a tree holding restrictions follows the user: restricted
    folders they own go to the trash with the tree, like children, and come
    back with it; the others lose their restriction and stay with their
    owners. Restored alone out of a trashed tree, a folder becomes a plain
    root
  • Moving a restriction entry to the root lifts the restriction for an
    owner of the folder, and is refused to anyone else
  • Lifting a restriction normalizes explicit roles and link reaches in
    the whole subtree, not only on the folder
  • Favorite and move on a restriction entry require being able to open
    the restricted folder
  • A restriction entry reports the accesses of its target, so an
    unshared restricted folder no longer shows up as shared

Frontend follow-ups, out of scope here: redirect on 403, context menu of
restriction entries (favorite should read abilities.favorite), wording.

Deleting the restriction entry from the parent folder is what the UI
does when the owner of the restricted folder removes it. The entry was
only detached and the folder stayed at the root, while the toast said
it was deleted. The owner now trashes the folder itself, other users
keep lifting the restriction out of their folder.

The restriction entry is trashed along with its target so that a
restore puts the folder back in place, but it must not show up in the
trash next to the folder.
Trashing a folder left the restricted folders of its subtree in limbo:
still restricted but reachable at the root, and brought back into the
tree when it was restored, even for users with no right on them.

The restricted folders now follow the user who trashes the tree. Those
the user owns go to the trash with the tree, like children, and come
back with it. The others lose their restriction and stay at the root
with their owners. Restored alone out of a trashed tree, a folder
becomes a plain root rather than keeping a restriction stuck in the
trash.
Moving a restricted folder to the root moved its restriction entry
there, pointing at a folder that already lives at the root: the folder
kept its restriction mark, and a first deletion only dropped the entry
while a second one was needed to trash the folder.

The owner of the folder now lifts the restriction instead, the folder
being already a root. Nobody else can take a folder they do not own
out of the tree this way.
Lifting a restriction only normalized the folder itself: an explicit
role or link reach on a descendant, equal or inferior to what it now
inherits, stayed explicit and survived the removal of the inherited
one above.

The normalization now walks the subtree top down, over the items that
carry explicit settings.
The abilities of a restriction entry came from the folder holding it:
an owner of that folder could favorite or move the entry of a
restricted folder they cannot even open.

Both abilities now also require being able to open the restricted
folder, through an access or its link, the same check the entry
already exposes as can_access.
A restriction entry counted the accesses of the folder holding it,
so a restricted folder shared with nobody showed up as shared when
its container was.

The entry now reports the accesses of the restricted folder itself,
a root whose direct accesses are all its accesses.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant