diff --git a/actions/radicale b/actions/radicale index 59f9a40cf..a73c87f1d 100755 --- a/actions/radicale +++ b/actions/radicale @@ -59,9 +59,6 @@ def subcommand_setup(_): if current_version and current_version < radicale.VERSION_2: aug.set('/files' + DEFAULT_FILE + '/ENABLE_RADICALE', 'yes') - - aug.set('/files' + CONFIG_FILE + '/rights/type', 'owner_only') - if current_version and current_version < radicale.VERSION_2: aug.set('/files' + CONFIG_FILE + '/server/hosts', '127.0.0.1:5232, [::1]:5232') aug.set('/files' + CONFIG_FILE + '/server/base_prefix', '/radicale/') @@ -70,6 +67,7 @@ def subcommand_setup(_): aug.set('/files' + CONFIG_FILE + '/well-known/carddav', '/radicale/%(user)s/carddav/') aug.set('/files' + CONFIG_FILE + '/auth/type', 'remote_user') + aug.set('/files' + CONFIG_FILE + '/rights/type', 'owner_only') aug.save() @@ -78,6 +76,15 @@ def subcommand_setup(_): def subcommand_configure(arguments): """Sets the radicale rights type to a particular value""" + current_version = radicale.get_package_version() + if not current_version: + print('Warning: Unable to get radicale version.') + + if current_version and current_version >= radicale.VERSION_2: + if arguments.rights_type == 'owner_only': + # Radicale 2.x default rights file is equivalent to owner_only. + arguments.rights_type = 'from_file' + aug = load_augeas() aug.set('/files' + CONFIG_FILE + '/rights/type', arguments.rights_type) aug.save() diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index e6f59b014..4f10fbf6b 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -177,6 +177,13 @@ def get_rights_value(): """Returns the current Rights value.""" aug = load_augeas() value = aug.get('/files' + CONFIG_FILE + '/rights/type') + + current_version = get_package_version() + if current_version and current_version >= VERSION_2: + if value == 'from_file': + # Radicale 2.x default rights file is equivalent to owner_only. + value = 'owner_only' + return value