mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
change wording of platform admin toggle to positive rather than negative
CHS Approved Wording 👍
also rename suppress_platform_admin -> disable_platform_admin_view in
the backend, as suppress is a kinda weird word.
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import json
|
||||
|
||||
from flask import current_app, redirect, render_template, session, url_for, abort
|
||||
from flask import (
|
||||
abort,
|
||||
current_app,
|
||||
redirect,
|
||||
render_template,
|
||||
session,
|
||||
url_for,
|
||||
)
|
||||
from flask_login import current_user, login_required
|
||||
from notifications_utils.url_safe_token import check_token
|
||||
|
||||
@@ -195,24 +202,24 @@ def user_profile_password():
|
||||
)
|
||||
|
||||
|
||||
@main.route("/user-profile/suppress-platform-admin", methods=['GET', 'POST'])
|
||||
@main.route("/user-profile/disable-platform-admin-view", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def user_profile_suppress_platform_admin():
|
||||
if not current_user.platform_admin and not session.get('suppress_platform_admin'):
|
||||
def user_profile_disable_platform_admin_view():
|
||||
if not current_user.platform_admin and not session.get('disable_platform_admin_view'):
|
||||
abort(403)
|
||||
|
||||
form = ServiceOnOffSettingForm(
|
||||
name="This setting will be cleared if you sign out and sign in again",
|
||||
enabled=session.get('suppress_platform_admin', False),
|
||||
truthy='Yes (view as regular user)',
|
||||
falsey='No (view as platform admin)',
|
||||
name="Signing in again clears this setting",
|
||||
enabled=not session.get('disable_platform_admin_view'),
|
||||
truthy='Yes',
|
||||
falsey='No',
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
session['suppress_platform_admin'] = form.enabled.data
|
||||
session['disable_platform_admin_view'] = not form.enabled.data
|
||||
return redirect(url_for('.user_profile'))
|
||||
|
||||
return render_template(
|
||||
'views/user-profile/suppress-platform-admin.html',
|
||||
'views/user-profile/disable-platform-admin-view.html',
|
||||
form=form
|
||||
)
|
||||
|
||||
@@ -176,7 +176,7 @@ class User(JSONModel, UserMixin):
|
||||
|
||||
@property
|
||||
def platform_admin(self):
|
||||
return self._platform_admin and not session.get('suppress_platform_admin', False)
|
||||
return self._platform_admin and not session.get('disable_platform_admin_view', False)
|
||||
|
||||
def has_permissions(self, *permissions, restrict_admin_usage=False):
|
||||
unknown_permissions = set(permissions) - all_permissions
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
{{ edit_field('Change', url_for('.user_profile_password')) }}
|
||||
{% endcall %}
|
||||
|
||||
{% if current_user.platform_admin or session.get('suppress_platform_admin') %}
|
||||
{% if current_user.platform_admin or session.get('disable_platform_admin_view') %}
|
||||
{% call row() %}
|
||||
{{ text_field('Suppress Platform Admin') }}
|
||||
{{ text_field('On' if session.get('suppress_platform_admin') else 'Off') }}
|
||||
{{ edit_field('Change', url_for('.user_profile_suppress_platform_admin')) }}
|
||||
{{ text_field('Use platform admin view') }}
|
||||
{{ text_field('Yes' if not session.get('disable_platform_admin_view') else 'No') }}
|
||||
{{ edit_field('Change', url_for('.user_profile_disable_platform_admin_view')) }}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{% from "components/radios.html" import radios %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Suppress platform admin view
|
||||
Use platform admin view
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="grid-row">
|
||||
<div class="column-five-sixths">
|
||||
{{ page_header(
|
||||
'Suppress platform admin',
|
||||
'Use platform admin view',
|
||||
back_link=url_for('.user_profile')
|
||||
) }}
|
||||
|
||||
Reference in New Issue
Block a user