mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-15 02:43:17 +02:00
Fixed admins being able to see all directories.
This commit is contained in:
1 parent
9a5b9530a3
commit
70a390f7cf
4 files changed
+15
-12
No files matched your search
+5
-6
@@ -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.")
|
||||
Reference in new issue
Block a user