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 <njoseph@riseup.net>
[sunil: Don't relocate setup() method]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Joseph Nuthalapati 2020-09-19 15:38:41 +05:30 committed by Sunil Mohan Adapa
parent 889810bb96
commit f69d8289f6
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -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():