From ab95aeffb99caf85c8356a835ad4fe9567162bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 17 Nov 2018 12:57:08 +0100 Subject: [PATCH 1/2] backoffice: hide per user view by default (#28101) --- tests/test_backoffice_pages.py | 10 ++++++++++ wcs/backoffice/management.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index 8c78ff775..e67a29848 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -3070,6 +3070,16 @@ def test_per_user_view(pub): user = create_user(pub) create_environment(pub) app = login(get_app(pub)) + resp = app.get('/backoffice/management/').follow() + assert 'Per User View' not in resp.body + + if not pub.site_options.has_section('options'): + pub.site_options.add_section('options') + pub.site_options.set('options', 'per-user-view', 'true') + fd = open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') + pub.site_options.write(fd) + fd.close() + resp = app.get('/backoffice/management/').follow() assert 'Per User View' in resp.body resp = resp.click(' User View') diff --git a/wcs/backoffice/management.py b/wcs/backoffice/management.py index c5a445638..a9e0e72cc 100644 --- a/wcs/backoffice/management.py +++ b/wcs/backoffice/management.py @@ -520,7 +520,8 @@ class ManagementDirectory(Directory): if get_publisher().is_using_postgresql() and \ get_publisher().get_site_option('postgresql_views') != 'false': r += htmltext('
  • %s
  • ') % _('Global View') - r += htmltext('
  • %s
  • ') % _('Per User View') + if get_publisher().has_site_option('per-user-view'): + r += htmltext('
  • %s
  • ') % _('Per User View') for formdef in formdefs: if formdef.geolocations: r += htmltext('
  • %s') % _('Map View') -- 2.19.1