diff options
-rw-r--r-- | apioforum/forum.py | 6 | ||||
-rw-r--r-- | 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 %} <fieldset> - <legend id="config_{{role_config.role}}">{{role_config.role}}</legend> + <legend id="config_{{role_config.role}}">{{role_config.role}}</legend> {% macro perm(p, description, tooltip) %} <input type="checkbox" @@ -46,11 +46,17 @@ {{perm("p_create_subforum","create subforæ", "allow users with the role to create subforæ in this forum. " + "they will automatically become a bureaucrat in this subforum.")}} - <input type="hidden" name="roleconfig_{{role_config.role}}" value="present"/> {% 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 %} + <input type="hidden" name="roleconfig_{{role_config.role}}" value="present"/> + + {% if forum.id != 1 or role_config.role != "other" %} + <hr/> + <input type="checkbox" name="delete_{{role_config.role}}" id="delete_{{role_config.role}}"/> + <label for="delete_{{role_config.role}}">remove</label> + {% endif %} </fieldset> {% endfor %} {% if role_configs %} |