mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Add page to archive user
Users can only be archived by Platform Admin from the user page (/users/<user_id>). This removes them from all services and orgs and updates their details.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from flask import render_template, request
|
||||
from flask import flash, redirect, render_template, request, url_for
|
||||
from flask_login import login_required
|
||||
|
||||
from app import user_api_client
|
||||
@@ -37,3 +37,15 @@ def user_information(user_id):
|
||||
user=user,
|
||||
services=services,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/users/<uuid:user_id>/archive", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def archive_user(user_id):
|
||||
if request.method == 'POST':
|
||||
user_api_client.archive_user(user_id)
|
||||
return redirect(url_for('.user_information', user_id=user_id))
|
||||
else:
|
||||
flash('There\'s no way to reverse this! Are you sure you want to archive this user?', 'delete')
|
||||
return user_information(user_id)
|
||||
|
||||
Reference in New Issue
Block a user