Removed random comments and replaced em-dashes with hyphens.

This commit is contained in:
sarah committed 2026-09-21 17:37:12 +02:00
1 parent 6083e00504
commit ee7e163837
24 files changed
+198 -363

No files matched your search

+1 -19
View File
@@ -42,11 +42,8 @@ def GetLockForPath(RootName: str, RelativePath: str) -> dict[str, Any] | None:
def SetLock(RootName: str, RelativePath: str, Usernames: list[str], GroupNames: list[str]) -> None:
"""Restrict a file or directory to specific users and/or groups. Passing
both empty lists is the same as removing the lock entirely.
"""
if not RelativePath:
raise ValueError("Can't lock an entire root — pick a specific file or directory.")
raise ValueError("Can't lock an entire root - pick a specific file or directory.")
if not Usernames and not GroupNames:
RemoveLock(RootName, RelativePath)
@@ -77,17 +74,6 @@ def RemoveLock(RootName: str, RelativePath: str) -> None:
def IsPathAccessible(
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
(by username or group) on every applicable lock. Locks don't propagate
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 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.
"""
for Lock in LoadLocks():
if Lock.get("Root") != RootName:
continue
@@ -110,10 +96,6 @@ def IsPathAccessible(
def RequirePathAccessible(RootName: str, RelativePath: str, CurrentUser: dict[str, Any]) -> None:
"""Raises a 404 (never a distinguishing "access denied") for a path the
current user isn't permitted to see, so a locked directory's existence
isn't revealed to anyone not on its list.
"""
if not IsPathAccessible(
RootName,
RelativePath,