rearrange and rename a couple of permissions

master
justcool393 2022-10-06 00:55:54 -07:00
parent 02d0e2043e
commit 8bed8c64e8
3 changed files with 12 additions and 12 deletions

View File

@ -319,7 +319,7 @@ class User(Base):
@lazy @lazy
def mod_date(self, sub): def mod_date(self, sub):
if self.admin_level >= PERMS['GLOBAL_HOLE_MODERATION']: return 1 if self.admin_level >= PERMS['HOLE_GLOBAL_MODERATION']: return 1
mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none() mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none()
if not mod: return None if not mod: return None
return mod.created_utc return mod.created_utc

View File

@ -121,7 +121,15 @@ AGENDAPOSTER_MSG_HTML = """<p>Hi <a href="/id/{id}"><img loading="lazy" src="/pp
################################################################################ ################################################################################
PERMS = { # Minimum admin_level to perform action. PERMS = { # Minimum admin_level to perform action.
'ADMIN_ADD': 3, # note: explicitly disabled on rDrama
'ADMIN_REMOVE': 3,
'ADMIN_ADD_PERM_LEVEL': 2, # permission level given when user added via site
'ADMIN_ACTIONS_REVERT': 3,
'ADMIN_MOP_VISIBLE': 2,
'ADMIN_HOME_VISIBLE': 2,
'DOMAINS_BAN': 3,
'HOLE_CREATE': 0, 'HOLE_CREATE': 0,
'HOLE_GLOBAL_MODERATION': 3,
'FLAGS_REMOVE': 2, 'FLAGS_REMOVE': 2,
'VOTES_VISIBLE': 0, 'VOTES_VISIBLE': 0,
'USER_BLOCKS_VISIBLE': 0, 'USER_BLOCKS_VISIBLE': 0,
@ -129,7 +137,6 @@ PERMS = { # Minimum admin_level to perform action.
'USER_VOTERS_VISIBLE': 0, 'USER_VOTERS_VISIBLE': 0,
'POST_COMMENT_MODERATION': 2, 'POST_COMMENT_MODERATION': 2,
'POST_COMMENT_DISTINGUISH': 1, 'POST_COMMENT_DISTINGUISH': 1,
'GLOBAL_HOLE_MODERATION': 3,
'POST_EDITING': 3, 'POST_EDITING': 3,
'USER_BADGES': 2, 'USER_BADGES': 2,
'USER_BAN': 2, 'USER_BAN': 2,
@ -137,6 +144,7 @@ PERMS = { # Minimum admin_level to perform action.
'USER_AGENDAPOSTER': 2, 'USER_AGENDAPOSTER': 2,
'USER_CLUB_ALLOW_BAN': 2, 'USER_CLUB_ALLOW_BAN': 2,
'USER_LINK': 2, 'USER_LINK': 2,
'USER_MERGE': 3, # note: extra check for Aevann
'USER_TITLE_CHANGE': 2, 'USER_TITLE_CHANGE': 2,
'POST_TO_CHANGELOG': 1, 'POST_TO_CHANGELOG': 1,
'POST_TO_POLL_THREAD': 2, 'POST_TO_POLL_THREAD': 2,
@ -165,20 +173,12 @@ PERMS = { # Minimum admin_level to perform action.
'VIEW_LAST_ACTIVE': 2, 'VIEW_LAST_ACTIVE': 2,
'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes 'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes
'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, # note: explicitly disabled on rDrama 'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, # note: explicitly disabled on rDrama
'MERGE_USERS': 3, # note: extra check for Aevann
'ADMIN_ADD': 3, # note: explicitly disabled on rDrama
'ADMIN_REMOVE': 3,
'ADMIN_ADD_PERM_LEVEL': 2, # permission level given when user added via site
'ADMIN_ACTIONS_REVERT': 3,
'ADMIN_MOP_VISIBLE': 2,
'ADMIN_HOME_VISIBLE': 2,
'SITE_SETTINGS': 3, 'SITE_SETTINGS': 3,
'SITE_SETTINGS_SIDEBARS_BANNERS_BADGES': 3, 'SITE_SETTINGS_SIDEBARS_BANNERS_BADGES': 3,
'SITE_SETTINGS_SNAPPY_QUOTES': 3, 'SITE_SETTINGS_SNAPPY_QUOTES': 3,
'SITE_SETTINGS_UNDER_ATTACK': 3, 'SITE_SETTINGS_UNDER_ATTACK': 3,
'SITE_CACHE_PURGE_CDN': 3, 'SITE_CACHE_PURGE_CDN': 3,
'SITE_CACHE_DUMP_INTERNAL': 2, 'SITE_CACHE_DUMP_INTERNAL': 2,
'DOMAINS_BAN': 3,
'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2, 'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2,
'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_HOLE_CREATION': 2,
'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, 'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3,

View File

@ -44,7 +44,7 @@ def loggedout_list(v):
return render_template("loggedout.html", v=v, users=users) return render_template("loggedout.html", v=v, users=users)
@app.get('/admin/merge/<id1>/<id2>') @app.get('/admin/merge/<id1>/<id2>')
@admin_level_required(PERMS['MERGE_USERS']) @admin_level_required(PERMS['USER_MERGE'])
def merge(v, id1, id2): def merge(v, id1, id2):
if v.id != AEVANN_ID: abort(403) if v.id != AEVANN_ID: abort(403)
@ -106,7 +106,7 @@ def merge(v, id1, id2):
@app.get('/admin/merge_all/<id>') @app.get('/admin/merge_all/<id>')
@admin_level_required(PERMS['MERGE_USERS']) @admin_level_required(PERMS['USER_MERGE'])
def merge_all(v, id): def merge_all(v, id):
if v.id != AEVANN_ID: abort(403) if v.id != AEVANN_ID: abort(403)