add rights value check
This commit is contained in:
@@ -66,6 +66,13 @@ def positive_float(value: Any) -> float:
|
|||||||
return value
|
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:
|
def logging_level(value: Any) -> str:
|
||||||
if value not in ("debug", "info", "warning", "error", "critical"):
|
if value not in ("debug", "info", "warning", "error", "critical"):
|
||||||
raise ValueError("unsupported level: %r" % value)
|
raise ValueError("unsupported level: %r" % value)
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ from radicale import config, utils
|
|||||||
INTERNAL_TYPES: Sequence[str] = ("authenticated", "owner_write", "owner_only",
|
INTERNAL_TYPES: Sequence[str] = ("authenticated", "owner_write", "owner_only",
|
||||||
"from_file")
|
"from_file")
|
||||||
|
|
||||||
|
INTERNAL_PERMISSIONS: str = "RriWwDdOoTtMm"
|
||||||
|
|
||||||
|
|
||||||
def load(configuration: "config.Configuration") -> "BaseRights":
|
def load(configuration: "config.Configuration") -> "BaseRights":
|
||||||
"""Load the rights module chosen in configuration."""
|
"""Load the rights module chosen in configuration."""
|
||||||
|
|||||||
Reference in New Issue
Block a user