Allow attach custom rights backend, small fix in default config file
This commit is contained in:
		
							
								
								
									
										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,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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sergey Fursov
					Sergey Fursov