Allow attach custom rights backend, small fix in default config file

This commit is contained in:
Sergey Fursov 2013-12-29 15:13:35 +04:00
parent 017df0ddcf
commit 1d0418594d
3 changed files with 14 additions and 5 deletions

7
config
View File

@ -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

View File

@ -78,6 +78,7 @@ INITIAL_CONFIG = {
"rights": {
"backend": "regex",
"type": "None",
"custom_handler": "",
"file": "~/.config/radicale/rights"},
"storage": {
"type": "filesystem",

View File

@ -31,6 +31,11 @@ from .. import config
def load():
"""Load list of available storage managers."""
storage_type = config.get("rights", "backend")
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)