From 3a3e427695f3f6754297a2dde335358518d3373a Mon Sep 17 00:00:00 2001 From: citrons Date: Fri, 25 Jun 2021 05:33:00 +0000 Subject: permissions table --- apioforum/db.py | 19 ++++++++++++++++++- apioforum/templates/view_forum.html | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apioforum/db.py b/apioforum/db.py index 7dd635e..06682d6 100644 --- a/apioforum/db.py +++ b/apioforum/db.py @@ -117,7 +117,24 @@ CREATE VIEW most_recent_posts AS CREATE VIEW number_of_posts AS SELECT thread, count(*) AS num_replies FROM posts GROUP BY thread; """, - +""" +CREATE TABLE role_config ( + role TEXT NOT NULL, + forum NOT NULL REFERENCES forums(id), + id INTEGER PRIMARY KEY, + + p_create_threads INT NOT NULL DEFAULT 1, + p_reply_threads INT NOT NULL DEFAULT 1, + p_view_threads INT NOT NULL DEFAULT 1, + p_delete_threads INT NOT NULL DEFAULT 0, + p_lock_threads INT NOT NULL DEFAULT 0, + p_approve INT NOT NULL DEFAULT 0, + p_create_subforum INT NOT NULL DEFAULT 0 +); + +INSERT INTO role_config (role,forum) SELECT "approved",id FROM forums; +INSERT INTO role_config (role,forum) SELECT "other",id FROM forums; +""", ] def init_db(): diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 96c51bb..fce051f 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -10,6 +10,7 @@ {%block content%} {% if forum.description %} {{forum.description|md|safe}} +
{% endif %} {% if subforums %} -- cgit v1.2.3