Locks: space-owner folder locking behind an instance setting (deferred from #315 L2) #395
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/Cairn#395
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Deferred from #315 (design point L2, shipped v0.6.106 / PR #393 files-only). L2 ratified files-only locking for users — freezing a subtree is the legal-hold instrument, an operator power — with one agreed extension: an instance setting that lets space OWNERS lock folders inside their own spaces (Nikola: "we could have this be enabled on a per instance setting in the administrator window to also allow space-owners to lock their spaces… needs a proper UI implementation then as well").
Semantics (from the L2 discussion)
hold.Affected-style subtree matching, not the file lock's exact-path match.unlock/break-lock.What to build
Setting.
spaceFolderLocksbool (default off) ininternal/settings; admin toggle in the dashboard (placement with the other instance-behaviour toggles; can share a "Locks" group with #394's cap row).Enforcement. Extend
internal/storage/filelock:Recordgains nothing (a dir lock is just a record whose path is a folder); the guard gains anAffected(p)-style check — walk parents of the target path against the index (in-memory, cheap). Only records flagged/created as folder locks participate in subtree matching, so file-lock behaviour is untouched.API.
POST /api/v1/lockaccepts folders when (a) setting on, (b) requester is the owning space's owner (reusespaceOwnerCached). Otherwise the existing 400 stands.UI. Row menu Lock/Unlock appears on folders when the feature is on and the viewer owns the space (server still enforces). Locked folders get the chip; children inherit enforcement but should NOT each render a chip (only the locked folder shows it) — listing enrichment stays exact-path.
Tests. Subtree refusal matrix (write/delete/rename/copy under a locked folder, non-owner vs owner), space-owner-only lock creation, setting off = folders rejected, chip only on the locked folder.
Refs: #315 (L2 + folder-scope answer), #394 (settings grouping),
internal/storage/hold(Affectedpattern),internal/api/spaces.go(owner), PR #393.