Remove the backend/type split for rights in configuration
This commit is contained in:
parent
f6a6e77fb0
commit
f9ce1d0e6d
4
config
4
config
@ -104,10 +104,6 @@ committer = Radicale <radicale@example.com>
|
||||
|
||||
[rights]
|
||||
# Rights backend
|
||||
# Value: regex | custom
|
||||
backend = regex
|
||||
|
||||
# Rights management method
|
||||
# Value: None | owner_only | owner_write | from_file | custom
|
||||
type = None
|
||||
|
||||
|
@ -76,7 +76,6 @@ INITIAL_CONFIG = {
|
||||
"git": {
|
||||
"committer": "Radicale <radicale@example.com>"},
|
||||
"rights": {
|
||||
"backend": "regex",
|
||||
"type": "None",
|
||||
"custom_handler": "",
|
||||
"file": "~/.config/radicale/rights"},
|
||||
|
@ -30,15 +30,14 @@ from .. import config
|
||||
|
||||
def load():
|
||||
"""Load list of available storage managers."""
|
||||
storage_type = config.get("rights", "backend")
|
||||
if storage_type == 'custom':
|
||||
storage_type = config.get("rights", "type")
|
||||
if storage_type == "custom":
|
||||
rights_module = config.get("rights", "custom_handler")
|
||||
__import__(rights_module)
|
||||
module = sys.modules[rights_module]
|
||||
else:
|
||||
root_module = __import__(
|
||||
"rights.%s" % storage_type, globals=globals(), level=2)
|
||||
module = getattr(root_module, storage_type)
|
||||
root_module = __import__("rights.regex", globals=globals(), level=2)
|
||||
module = root_module.regex
|
||||
sys.modules[__name__].authorized = module.authorized
|
||||
return module
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user