add rights value check

This commit is contained in:
Peter Bieringer
2026-02-26 08:12:49 +01:00
parent cfe2f23d60
commit 3ad1b1a12a
2 changed files with 9 additions and 0 deletions

View File

@@ -66,6 +66,13 @@ def positive_float(value: Any) -> float:
return value
def rights_permission(value: Any) -> str:
for permission in value:
if permission not in rights.INTERNAL_PERMISSIONS:
raise ValueError("unsupported permssion %r found in: %r" % (permission, value))
return value
def logging_level(value: Any) -> str:
if value not in ("debug", "info", "warning", "error", "critical"):
raise ValueError("unsupported level: %r" % value)

View File

@@ -43,6 +43,8 @@ from radicale import config, utils
INTERNAL_TYPES: Sequence[str] = ("authenticated", "owner_write", "owner_only",
"from_file")
INTERNAL_PERMISSIONS: str = "RriWwDdOoTtMm"
def load(configuration: "config.Configuration") -> "BaseRights":
"""Load the rights module chosen in configuration."""