From 70a390f7cf2108231f6bb9ce3c36d9ff60101452 Mon Sep 17 00:00:00 2001 From: SRHTNIN Date: Mon, 21 Sep 2026 16:47:56 +0200 Subject: [PATCH] Fixed admins being able to see all directories. --- .gitignore | 3 +++ Backend/Locks.py | 11 +++++------ Backend/Main.py | 7 +++---- README.md | 6 ++++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 2b179d1..24f1b08 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ Frontend/dist/ .DS_Store .vscode/ .idea/ + +# Misc +.Todo/ diff --git a/Backend/Locks.py b/Backend/Locks.py index d44df00..c604369 100644 --- a/Backend/Locks.py +++ b/Backend/Locks.py @@ -75,7 +75,7 @@ def RemoveLock(RootName: str, RelativePath: str) -> None: def IsPathAccessible( - RootName: str, RelativePath: str, Username: str, UserGroups: list[str], IsAdmin: bool + RootName: str, RelativePath: str, Username: str, UserGroups: list[str] ) -> bool: """A path is inaccessible if it IS a locked file/directory, or lies anywhere underneath a locked directory, and the user isn't permitted @@ -83,11 +83,11 @@ def IsPathAccessible( to subdirectories as separate records — there's only ever one lock entry per locked directory — but access to anything inside still requires being permitted on that ancestor lock, so you always have to - "enter the parent first." Admins bypass every lock. + "enter the parent first." Admins do NOT bypass locks - Admin is a + management group (create users, manage groups, and so on), not a way + to view everyone's private directories. Only direct server/filesystem + access can see everything. """ - if IsAdmin: - return True - for Lock in LoadLocks(): if Lock.get("Root") != RootName: continue @@ -119,6 +119,5 @@ def RequirePathAccessible(RootName: str, RelativePath: str, CurrentUser: dict[st RelativePath, CurrentUser["Username"], CurrentUser.get("Groups", []), - CurrentUser.get("IsAdmin", False), ): raise HTTPException(status_code=404, detail="Not found.") diff --git a/Backend/Main.py b/Backend/Main.py index 647779a..d70fc94 100644 --- a/Backend/Main.py +++ b/Backend/Main.py @@ -318,9 +318,10 @@ def PutGroupMembersEndpoint( # --- Locked files/directories ----------------------------------------------- -# Setting a lock is open to anyone who currently has access to the path — +# Setting a lock is open to anyone who currently has access to the path - # not admin-only. If you can see it, you're trusted to decide who else can. -# Admins additionally bypass every lock (see Locks.IsPathAccessible). +# Admins do NOT bypass locks (see Locks.IsPathAccessible) - Admin is a +# management group, not a way to view everyone's private directories. @Application.get("/api/lock") @@ -384,7 +385,6 @@ def GetTreeEndpoint( Username = CurrentUser["Username"] UserGroups = CurrentUser.get("Groups", []) - IsAdmin = CurrentUser.get("IsAdmin", False) # A locked subdirectory (or anything inside one) shouldn't even appear # in its parent's listing for someone without access to it. @@ -396,7 +396,6 @@ def GetTreeEndpoint( f"{Path}/{Entry['Name']}" if Path else Entry["Name"], Username, UserGroups, - IsAdmin, ) ] diff --git a/README.md b/README.md index af8f49c..28aeb72 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,10 @@ restrict a file or directory to specific users and/or groups, whether at creation time (the New File/New Directory dialog includes a search-and- checkbox picker) or afterwards via the 🔒 button next to any entry, in either the sidebar tree or the directory-browse pane. If you can currently -see something, you're trusted to change who else can. Admins additionally -bypass every restriction, so they can always troubleshoot. +see something, you're trusted to change who else can. Admins do not bypass +restrictions - Admin is a management group (creating users, managing groups, +and so on), not a way to view everyone's private directories. Only direct +access to the server's files can see everything. Restricting is per-file-or-directory — locking a directory covers everything inside it automatically (there's only ever one restriction record per locked