feat: folder shares apply to hosts added later (#1343)

* feat: folder shares apply to hosts added later

Sharing a folder only fanned grants out to the hosts in it at the time.
The share is now also kept as a standing rule on the folder, and a host
created in or moved into it (or a subfolder) inherits the same access
and secret snapshots. Rules follow folder renames and can be stopped
from the share dialog.

* fix: stabilize folder access migrations
This commit is contained in:
ZacharyZcR
2026-08-25 04:50:51 +08:00
committed by GitHub
parent 82143946c7
commit 302ac19e6c
24 changed files with 28903 additions and 20 deletions
+17
View File
@@ -0,0 +1,17 @@
CREATE TABLE `folder_access` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`owner_user_id` text NOT NULL,
`folder` text NOT NULL,
`user_id` text,
`role_id` integer,
`granted_by` text NOT NULL,
`permission_level` text DEFAULT 'connect' NOT NULL,
`expires_at` text,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (`owner_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`role_id`) REFERENCES `roles`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`granted_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `idx_folder_access_owner_folder` ON `folder_access` (`owner_user_id`,`folder`);
File diff suppressed because it is too large Load Diff
+7
View File
@@ -106,6 +106,13 @@
"when": 1787600440707,
"tag": "0014_lean_doctor_octopus",
"breakpoints": true
},
{
"idx": 15,
"version": "6",
"when": 1787602476319,
"tag": "0015_glossy_shotgun",
"breakpoints": true
}
]
}