Merge pull request #1196 from dod-ccpo/revoke-env-access
Catch CSP exceptions and display a flash message with the error
This commit is contained in:
commit
25a5cb136c
@ -6,6 +6,7 @@ from atst.domain.environments import Environments
|
||||
from atst.domain.applications import Applications
|
||||
from atst.domain.application_roles import ApplicationRoles
|
||||
from atst.domain.audit_log import AuditLog
|
||||
from atst.domain.csp.cloud import GeneralCSPException
|
||||
from atst.domain.common import Paginator
|
||||
from atst.domain.environment_roles import EnvironmentRoles
|
||||
from atst.domain.invitations import ApplicationInvitations
|
||||
@ -221,7 +222,10 @@ def handle_update_member(application_id, application_role_id, form_data):
|
||||
)
|
||||
|
||||
if form.validate():
|
||||
ApplicationRoles.update_permission_sets(app_role, form.data["permission_sets"])
|
||||
try:
|
||||
ApplicationRoles.update_permission_sets(
|
||||
app_role, form.data["permission_sets"]
|
||||
)
|
||||
|
||||
for env_role in form.environment_roles:
|
||||
environment = Environments.get(env_role.environment_id.data)
|
||||
@ -229,6 +233,11 @@ def handle_update_member(application_id, application_role_id, form_data):
|
||||
Environments.update_env_role(environment, app_role, new_role)
|
||||
|
||||
flash("application_member_updated", user_name=app_role.user_name)
|
||||
|
||||
except GeneralCSPException:
|
||||
flash(
|
||||
"application_member_update_error", user_name=app_role.user_name,
|
||||
)
|
||||
else:
|
||||
pass
|
||||
# TODO: flash error message
|
||||
|
@ -54,6 +54,11 @@ MESSAGES = {
|
||||
"message_template": "You have successfully deleted {{ user_name }} from {{ application_name }}",
|
||||
"category": "success",
|
||||
},
|
||||
"application_member_update_error": {
|
||||
"title_template": "{{ user_name }} could not be updated",
|
||||
"message_template": "An unexpected problem occurred with your request, please try again. If the problem persists, contact an administrator.",
|
||||
"category": "error",
|
||||
},
|
||||
"application_member_updated": {
|
||||
"title_template": "Team member updated",
|
||||
"message_template": "You have successfully updated the permissions for {{ user_name }}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user