Przeglądaj źródła

align option name

Peter Bieringer 1 rok temu
rodzic
commit
a79c2ad83e
4 zmienionych plików z 12 dodań i 10 usunięć
  1. 2 2
      DOCUMENTATION.md
  2. 2 2
      config
  3. 2 2
      radicale/config.py
  4. 6 4
      radicale/rights/from_file.py

+ 2 - 2
DOCUMENTATION.md

@@ -978,9 +978,9 @@ Log response on level=debug
 
 
 Default: `False`
 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`
 Default: `False`
 
 

+ 2 - 2
config

@@ -158,8 +158,8 @@
 # Log response content on level=debug
 # Log response content on level=debug
 #response_content_on_debug = False
 #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]
 [headers]
 
 

+ 2 - 2
radicale/config.py

@@ -292,9 +292,9 @@ DEFAULT_CONFIG_SCHEMA: types.CONFIG_SCHEMA = OrderedDict([
             "value": "False",
             "value": "False",
             "help": "log response content on level=debug",
             "help": "log response content on level=debug",
             "type": bool}),
             "type": bool}),
-        ("right_doesnt_match", {
+        ("rights_rule_doesnt_match_on_debug", {
             "value": "False",
             "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}),
             "type": bool}),
         ("mask_passwords", {
         ("mask_passwords", {
             "value": "True",
             "value": "True",

+ 6 - 4
radicale/rights/from_file.py

@@ -48,7 +48,7 @@ class Rights(rights.BaseRights):
     def __init__(self, configuration: config.Configuration) -> None:
     def __init__(self, configuration: config.Configuration) -> None:
         super().__init__(configuration)
         super().__init__(configuration)
         self._filename = configuration.get("rights", "file")
         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:
     def authorization(self, user: str, path: str) -> str:
         user = user or ""
         user = user or ""
@@ -62,6 +62,8 @@ class Rights(rights.BaseRights):
         except Exception as e:
         except Exception as e:
             raise RuntimeError("Failed to load rights file %r: %s" %
             raise RuntimeError("Failed to load rights file %r: %s" %
                                (self._filename, e)) from e
                                (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():
         for section in rights_config.sections():
             try:
             try:
                 user_pattern = rights_config.get(section, "user")
                 user_pattern = rights_config.get(section, "user")
@@ -81,9 +83,9 @@ class Rights(rights.BaseRights):
                              user, sane_path, user_pattern,
                              user, sane_path, user_pattern,
                              collection_pattern, section, permission)
                              collection_pattern, section, permission)
                 return 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",
                 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)
         logger.info("Rights: %r:%r doesn't match any section", user, sane_path)
         return ""
         return ""