From 2cbb238d80533cf06b1b6a7e1353843a0f583dea Mon Sep 17 00:00:00 2001 From: citrons Date: Sat, 7 Aug 2021 01:16:20 +0000 Subject: admin users are automatically bureaucrats --- apioforum/forum.py | 1 + apioforum/roles.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/apioforum/forum.py b/apioforum/forum.py index d177b16..bbc43fe 100644 --- a/apioforum/forum.py +++ b/apioforum/forum.py @@ -1,5 +1,6 @@ # view threads in a forum # currently there is only ever one forum however +# ^ aha we never removed this. we should keep it. it is funny. from flask import ( Blueprint, render_template, request, diff --git a/apioforum/roles.py b/apioforum/roles.py index 1e9b206..bd913a0 100644 --- a/apioforum/roles.py +++ b/apioforum/roles.py @@ -37,6 +37,10 @@ def get_role_config(forum_id, role): def get_user_role(forum_id, user): db = get_db() + user = db.execute('SELECT * FROM users WHERE username = ?', + (user,)).fetchone() + if user == None: return "other" + if user['admin']: return "bureaucrat" fid = forum_id the = None -- cgit v1.2.3