diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 342b89cb..644ad012 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -978,9 +978,9 @@ Log response on level=debug Default: `False` -##### right_doesnt_match = True +##### rights_rule_doesnt_match_on_debug = True -Log right which doesn't match on level=debug +Log rights rule which doesn't match on level=debug Default: `False` diff --git a/config b/config index 0a999877..8c75bf77 100644 --- a/config +++ b/config @@ -158,8 +158,8 @@ # Log response content on level=debug #response_content_on_debug = False -# Log right which doesn't match -#right_doesnt_match = False +# Log rights rule which doesn't match on level=debug +#rights_rule_doesnt_match_on_debug = False [headers] diff --git a/radicale/config.py b/radicale/config.py index 46fafbb8..d5797c13 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -292,9 +292,9 @@ DEFAULT_CONFIG_SCHEMA: types.CONFIG_SCHEMA = OrderedDict([ "value": "False", "help": "log response content on level=debug", "type": bool}), - ("right_doesnt_match", { + ("rights_rule_doesnt_match_on_debug", { "value": "False", - "help": "log rights which doesn't match on level=debug", + "help": "log rights rules which doesn't match on level=debug", "type": bool}), ("mask_passwords", { "value": "True", diff --git a/radicale/rights/from_file.py b/radicale/rights/from_file.py index 47218085..79e0994f 100644 --- a/radicale/rights/from_file.py +++ b/radicale/rights/from_file.py @@ -48,7 +48,7 @@ class Rights(rights.BaseRights): def __init__(self, configuration: config.Configuration) -> None: super().__init__(configuration) self._filename = configuration.get("rights", "file") - self._log_right_doesnt_match = configuration.get("logging", "right_doesnt_match") + self._log_rights_rule_doesnt_match_on_debug = configuration.get("logging", "rights_rule_doesnt_match_on_debug") def authorization(self, user: str, path: str) -> str: user = user or "" @@ -62,6 +62,8 @@ class Rights(rights.BaseRights): except Exception as e: raise RuntimeError("Failed to load rights file %r: %s" % (self._filename, e)) from e + if not self._log_rights_rule_doesnt_match_on_debug: + logger.debug("logging of rules which doesn't match suppressed by config/option [logging] rights_rule_doesnt_match_on_debug") for section in rights_config.sections(): try: user_pattern = rights_config.get(section, "user") @@ -81,9 +83,9 @@ class Rights(rights.BaseRights): user, sane_path, user_pattern, collection_pattern, section, permission) return permission - if self._log_right_doesnt_match: + if self._log_rights_rule_doesnt_match_on_debug: logger.debug("Rule %r:%r doesn't match %r:%r from section %r", - user, sane_path, user_pattern, collection_pattern, - section) + user, sane_path, user_pattern, collection_pattern, + section) logger.info("Rights: %r:%r doesn't match any section", user, sane_path) return ""