mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
make role IDs into constants #226
This commit is contained in:
parent
c04d9522cd
commit
8548f3e2a2
2 changed files with 7 additions and 3 deletions
|
@ -32,4 +32,7 @@ NOTIF_TOPIC = 2
|
|||
NOTIF_POST = 3
|
||||
NOTIF_REPLY = 4
|
||||
|
||||
ROLE_STAFF = 3
|
||||
ROLE_ADMIN = 4
|
||||
|
||||
MICROBLOG_APPS = ["mastodon", "misskey", "akkoma", "iceshrimp", "pleroma"]
|
||||
|
|
|
@ -20,7 +20,8 @@ import os
|
|||
import math
|
||||
|
||||
from app.constants import SUBSCRIPTION_NONMEMBER, SUBSCRIPTION_MEMBER, SUBSCRIPTION_MODERATOR, SUBSCRIPTION_OWNER, \
|
||||
SUBSCRIPTION_BANNED, SUBSCRIPTION_PENDING, NOTIF_USER, NOTIF_COMMUNITY, NOTIF_TOPIC, NOTIF_POST, NOTIF_REPLY
|
||||
SUBSCRIPTION_BANNED, SUBSCRIPTION_PENDING, NOTIF_USER, NOTIF_COMMUNITY, NOTIF_TOPIC, NOTIF_POST, NOTIF_REPLY, \
|
||||
ROLE_ADMIN, ROLE_STAFF
|
||||
|
||||
|
||||
# datetime.utcnow() is depreciated in Python 3.12 so it will need to be swapped out eventually
|
||||
|
@ -1506,11 +1507,11 @@ class Site(db.Model):
|
|||
|
||||
@staticmethod
|
||||
def admins() -> List[User]:
|
||||
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == 4).order_by(User.id).all()
|
||||
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == ROLE_ADMIN).order_by(User.id).all()
|
||||
|
||||
@staticmethod
|
||||
def staff() -> List[User]:
|
||||
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == 3).order_by(User.id).all()
|
||||
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == ROLE_STAFF).order_by(User.id).all()
|
||||
|
||||
|
||||
#class IngressQueue(db.Model):
|
||||
|
|
Loading…
Add table
Reference in a new issue