mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Fixed linting and build errors
This commit is contained in:
@@ -185,7 +185,7 @@ def _csp(config):
|
||||
def create_app(application):
|
||||
@application.after_request
|
||||
def add_security_headers(response):
|
||||
response.headers['Cross-Origin-Embedder-Policy'] = 'credentialless'
|
||||
response.headers["Cross-Origin-Embedder-Policy"] = "credentialless"
|
||||
return response
|
||||
|
||||
@application.context_processor
|
||||
@@ -273,11 +273,11 @@ def create_app(application):
|
||||
content_security_policy=_csp(application.config),
|
||||
content_security_policy_nonce_in=["style-src", "script-src"],
|
||||
permissions_policy={
|
||||
"accelerometer": "(self \"https://www.youtube-nocookie.com\")",
|
||||
"autoplay": "(self \"https://www.youtube-nocookie.com\")",
|
||||
"accelerometer": '(self "https://www.youtube-nocookie.com")',
|
||||
"autoplay": '(self "https://www.youtube-nocookie.com")',
|
||||
"camera": "()",
|
||||
"geolocation": "()",
|
||||
"gyroscope": "(self \"https://www.youtube-nocookie.com\")",
|
||||
"gyroscope": '(self "https://www.youtube-nocookie.com")',
|
||||
"local-fonts": "()",
|
||||
"magnetometer": "()",
|
||||
"microphone": "()",
|
||||
@@ -543,7 +543,7 @@ def register_errorhandlers(application): # noqa (C901 too complex)
|
||||
application.logger.warning(
|
||||
f"API {error_url} failed with status {error.status_code} message {error.message}",
|
||||
exc_info=sys.exc_info(),
|
||||
stack_info=True
|
||||
stack_info=True,
|
||||
)
|
||||
|
||||
error_code = error.status_code
|
||||
@@ -555,7 +555,7 @@ def register_errorhandlers(application): # noqa (C901 too complex)
|
||||
application.logger.exception(
|
||||
f"API {error_url} failed with status {error.status_code} message {error.message}",
|
||||
exc_info=sys.exc_info(),
|
||||
stack_info=True
|
||||
stack_info=True,
|
||||
)
|
||||
|
||||
error_code = 500
|
||||
|
||||
@@ -16,9 +16,7 @@ class Config(object):
|
||||
API_PUBLIC_WS_URL = getenv("API_PUBLIC_WS_URL", "localhost")
|
||||
|
||||
ADMIN_BASE_URL = getenv("ADMIN_BASE_URL", "http://localhost:6012")
|
||||
HEADER_COLOUR = (
|
||||
"#81878b" # mix of dark-grey and mid-grey
|
||||
)
|
||||
HEADER_COLOUR = "#81878b" # mix of dark-grey and mid-grey
|
||||
|
||||
ASSETS_DEBUG = False
|
||||
|
||||
|
||||
@@ -73,7 +73,9 @@ def invite_user(service_id, user_id=None):
|
||||
else:
|
||||
user_to_invite = None
|
||||
|
||||
service_has_email_auth = current_service.has_permission(ServicePermission.EMAIL_AUTH)
|
||||
service_has_email_auth = current_service.has_permission(
|
||||
ServicePermission.EMAIL_AUTH
|
||||
)
|
||||
if not service_has_email_auth:
|
||||
form.login_authentication.data = "sms_auth"
|
||||
|
||||
@@ -116,7 +118,9 @@ def invite_user(service_id, user_id=None):
|
||||
@main.route("/services/<uuid:service_id>/users/<uuid:user_id>", methods=["GET", "POST"])
|
||||
@user_has_permissions(ServicePermission.MANAGE_SERVICE)
|
||||
def edit_user_permissions(service_id, user_id):
|
||||
service_has_email_auth = current_service.has_permission(ServicePermission.EMAIL_AUTH)
|
||||
service_has_email_auth = current_service.has_permission(
|
||||
ServicePermission.EMAIL_AUTH
|
||||
)
|
||||
user = current_service.get_team_member(user_id)
|
||||
|
||||
mobile_number = None
|
||||
|
||||
@@ -94,7 +94,9 @@ def view_notification(service_id, notification_id, error_message=None):
|
||||
updated_at=notification["sent_at"],
|
||||
help=get_help_argument(),
|
||||
notification_id=notification["id"],
|
||||
can_receive_inbound=(current_service.has_permission(ServicePermission.INBOUND_SMS)),
|
||||
can_receive_inbound=(
|
||||
current_service.has_permission(ServicePermission.INBOUND_SMS)
|
||||
),
|
||||
sent_with_test_key=(notification.get("key_type") == KEY_TYPE_TEST),
|
||||
back_link=back_link,
|
||||
)
|
||||
|
||||
@@ -560,7 +560,9 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
|
||||
max_errors_shown=50,
|
||||
guestlist=allow_list,
|
||||
remaining_messages=remaining_messages,
|
||||
allow_international_sms=current_service.has_permission(ServicePermission.INTERNATIONAL_SMS),
|
||||
allow_international_sms=current_service.has_permission(
|
||||
ServicePermission.INTERNATIONAL_SMS
|
||||
),
|
||||
)
|
||||
|
||||
if request.args.get("from_test"):
|
||||
|
||||
@@ -4,7 +4,10 @@ from app.enums import ServicePermission
|
||||
|
||||
permission_mappings = {
|
||||
# TODO: consider turning off email-sending permissions during SMS pilot
|
||||
ServicePermission.SEND_MESSAGES: [ServicePermission.SEND_TEXTS, ServicePermission.SEND_EMAILS],
|
||||
ServicePermission.SEND_MESSAGES: [
|
||||
ServicePermission.SEND_TEXTS,
|
||||
ServicePermission.SEND_EMAILS,
|
||||
],
|
||||
ServicePermission.MANAGE_TEMPLATES: [ServicePermission.MANAGE_TEMPLATES],
|
||||
ServicePermission.MANAGE_SERVICE: [
|
||||
ServicePermission.MANAGE_USERS,
|
||||
|
||||
Reference in New Issue
Block a user