From f69d8289f64961c85a6dab2f8baf8f2c7d64bfd5 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Sat, 19 Sep 2020 15:38:41 +0530 Subject: [PATCH] bepasty: Change default permissions to 'read' Allow read access by URL by default. Tests: - Installing bepasty fresh show the default permissions as read. - Upgrading bepasty from older version when default permissions are none sets the default permissions to read. - Upgrading bepasty from older version when default permissions are not none retrains the permissions. Signed-off-by: Joseph Nuthalapati [sunil: Don't relocate setup() method] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa Tested-by: Sunil Mohan Adapa --- actions/bepasty | 2 +- plinth/modules/bepasty/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/actions/bepasty b/actions/bepasty index f6bc5eb46..b8bf179a0 100755 --- a/actions/bepasty +++ b/actions/bepasty @@ -148,7 +148,7 @@ def subcommand_setup(arguments): passwords[1]: 'editor', passwords[2]: 'viewer', }, - 'DEFAULT_PERMISSIONS': '', + 'DEFAULT_PERMISSIONS': 'read', } conf_file_write(conf) CONF_FILE.chmod(0o640) diff --git a/plinth/modules/bepasty/__init__.py b/plinth/modules/bepasty/__init__.py index 597d87513..0fa082e8c 100644 --- a/plinth/modules/bepasty/__init__.py +++ b/plinth/modules/bepasty/__init__.py @@ -15,7 +15,7 @@ from plinth.modules.firewall.components import Firewall from .manifest import backup, clients # noqa, pylint: disable=unused-import -version = 1 +version = 2 managed_packages = ['bepasty', 'uwsgi', 'uwsgi-plugin-python3'] @@ -98,6 +98,9 @@ def setup(helper, old_version=None): helper.call('post', actions.superuser_run, 'bepasty', ['setup', '--domain-name', 'freedombox.local']) helper.call('post', app.enable) + if old_version == 1 and not get_configuration().get('DEFAULT_PERMISSIONS'): + # Upgrade to a better default only if user hasn't changed the value. + set_default_permissions('read') def get_configuration():