aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcitrons <citrons>2021-06-25 05:33:00 +0000
committercitrons <citrons>2021-06-25 05:33:00 +0000
commit3a3e427695f3f6754297a2dde335358518d3373a (patch)
tree2fb6b2d400ee47727e370e5454047ac654305074
parent4bb33e0c18b45ae0cc0f87438c8e0432cf6250c1 (diff)
permissions table
-rw-r--r--apioforum/db.py19
-rw-r--r--apioforum/templates/view_forum.html1
2 files changed, 19 insertions, 1 deletions
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}}
+<hr/>
{% endif %}
{% if subforums %}