From 09f38fd67bae05c7998ab9573d5842d02df247d8 Mon Sep 17 00:00:00 2001 From: citrons Date: Sat, 7 Aug 2021 23:22:51 +0000 Subject: one is now able to remove a role configuration --- apioforum/forum.py | 6 +++++- apioforum/templates/edit_permissions.html | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apioforum/forum.py b/apioforum/forum.py index bbc43fe..270b328 100644 --- a/apioforum/forum.py +++ b/apioforum/forum.py @@ -214,7 +214,11 @@ def edit_roles(forum): if request.method == "POST": for config in role_configs: - if 'roleconfig_' + config['role'] in request.form: + if 'delete_' + config['role'] in request.form: + db.execute( + "DELETE FROM role_config WHERE forum = ? AND role = ?", + (forum['id'],config['role'])) + elif 'roleconfig_' + config['role'] in request.form: for p in role_permissions: permission_setting =\ f"perm_{config['role']}_{p}" in request.form diff --git a/apioforum/templates/edit_permissions.html b/apioforum/templates/edit_permissions.html index f91c710..c92c9a9 100644 --- a/apioforum/templates/edit_permissions.html +++ b/apioforum/templates/edit_permissions.html @@ -16,7 +16,7 @@ {% for role_config in role_configs %}
- {{role_config.role}} + {{role_config.role}} {% macro perm(p, description, tooltip) %} {% if role_config.role != "other" %} {{perm("p_approve","approve others", "allow users with the role to assign the 'approved' role to those with the 'other' role")}} {% endif %} + + + {% if forum.id != 1 or role_config.role != "other" %} +
+ + + {% endif %}
{% endfor %} {% if role_configs %} -- cgit v1.2.3