Allow attach custom rights backend, small fix in default config file
This commit is contained in:
parent
017df0ddcf
commit
1d0418594d
7
config
7
config
@ -105,12 +105,15 @@ committer = Firstname Lastname <Radicale@Radicale.org>
|
||||
[rights]
|
||||
# Rights backend
|
||||
# Value: regex
|
||||
backend = "regex"
|
||||
backend = regex
|
||||
|
||||
# Rights management method
|
||||
# Value: None | owner_only | owner_write | from_file
|
||||
# Value: None | owner_only | owner_write | from_file | custom
|
||||
type = None
|
||||
|
||||
# Rights custom handler
|
||||
custom_handler =
|
||||
|
||||
# File for rights management from_file
|
||||
file = ~/.config/radicale/rights
|
||||
|
||||
|
@ -78,6 +78,7 @@ INITIAL_CONFIG = {
|
||||
"rights": {
|
||||
"backend": "regex",
|
||||
"type": "None",
|
||||
"custom_handler": "",
|
||||
"file": "~/.config/radicale/rights"},
|
||||
"storage": {
|
||||
"type": "filesystem",
|
||||
|
@ -31,9 +31,14 @@ from .. import config
|
||||
def load():
|
||||
"""Load list of available storage managers."""
|
||||
storage_type = config.get("rights", "backend")
|
||||
root_module = __import__(
|
||||
"rights.%s" % storage_type, globals=globals(), level=2)
|
||||
module = getattr(root_module, storage_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)
|
||||
sys.modules[__name__].authorized = module.authorized
|
||||
return module
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user