Merge pull request #1011 from dod-ccpo/remove-ccpo-user

Remove CCPO user
This commit is contained in:
leigh-mil
2019-08-13 16:29:07 -04:00
committed by GitHub
6 changed files with 85 additions and 3 deletions

View File

@@ -26,7 +26,8 @@ def activity_history():
@user_can(Permissions.VIEW_CCPO_USER, message="view ccpo users")
def users():
users = Users.get_ccpo_users()
return render_template("ccpo/users.html", users=users)
users_info = [(user, CCPOUserForm(obj=user)) for user in users]
return render_template("ccpo/users.html", users_info=users_info)
@bp.route("/ccpo-users/new")
@@ -56,3 +57,12 @@ def confirm_new_user():
Users.give_ccpo_perms(user)
flash("ccpo_user_added", user_name=user.full_name)
return redirect(url_for("ccpo.users"))
@bp.route("/ccpo-users/remove-access/<user_id>", methods=["POST"])
@user_can(Permissions.DELETE_CCPO_USER, message="remove ccpo user")
def remove_access(user_id):
user = Users.get(user_id)
Users.revoke_ccpo_perms(user)
flash("ccpo_user_removed", user_name=user.full_name)
return redirect(url_for("ccpo.users"))

View File

@@ -40,6 +40,11 @@ MESSAGES = {
"message_template": translate("ccpo.form.user_not_found_text"),
"category": "info",
},
"ccpo_user_removed": {
"title_template": translate("flash.success"),
"message_template": "You have successfully removed {{ user_name }}'s CCPO permissions.",
"category": "success",
},
"environment_added": {
"title_template": translate("flash.success"),
"message_template": """