From 04f24cd8fd6226ce7b2d2da2ee110a6beeee8c33 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 17:57:08 -0700 Subject: [PATCH 01/81] content moderation permission level holy crap there's a lot --- files/classes/comment.py | 8 +++---- files/classes/submission.py | 8 +++---- files/helpers/const.py | 1 + files/routes/admin.py | 28 ++++++++++++------------- files/routes/chat.py | 2 +- files/routes/comments.py | 4 ++-- files/routes/posts.py | 10 ++++----- files/templates/comments.html | 12 +++++------ files/templates/post_actions.html | 6 +++--- files/templates/submission.html | 2 +- files/templates/submission_banned.html | 2 +- files/templates/submission_listing.html | 2 +- 12 files changed, 43 insertions(+), 42 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 1c19786bf..eaf7286d0 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -330,8 +330,8 @@ class Comment(Base): def realbody(self, v): if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id] or (self.parent_comment and v.id == self.parent_comment.author_id))): return f"

{CC} ONLY

" - if self.deleted_utc != 0 and not (v and (v.admin_level >= 2) or v.id == self.author.id): return "[Deleted by user]" - if self.is_banned and not (v and v.admin_level >= 2): return "[Removed by admins]"; + if self.deleted_utc != 0 and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION']) or v.id == self.author.id): return "[Deleted by user]" + if self.is_banned and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']): return "[Removed by admins]"; body = self.body_html or "" @@ -397,8 +397,8 @@ class Comment(Base): def plainbody(self, v): if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id] or (self.parent_comment and v.id == self.parent_comment.author_id))): return f"{CC} ONLY" - if self.deleted_utc != 0 and not (v and (v.admin_level >= 2 or v.id == self.author.id)): return "[Deleted by user]" - if self.is_banned and not (v and v.admin_level >= 2): return "[Removed by admins]"; + if self.deleted_utc != 0 and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or v.id == self.author.id)): return "[Deleted by user]" + if self.is_banned and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']): return "[Removed by admins]" body = self.body diff --git a/files/classes/submission.py b/files/classes/submission.py index 046aa1681..fb7c81a52 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -334,8 +334,8 @@ class Submission(Base): @lazy def realbody(self, v, listing=False): if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{CC} ONLY

" - if self.deleted_utc != 0 and not (v and (v.admin_level >= 2) or v.id == self.author.id): return "[Deleted by user]" - if self.is_banned and not (v and v.admin_level >= 2): return "[Removed by admins]" + if self.deleted_utc != 0 and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION']) or v.id == self.author.id): return "[Deleted by user]" + if self.is_banned and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']): return "[Removed by admins]" body = self.body_html or "" @@ -403,8 +403,8 @@ class Submission(Base): @lazy def plainbody(self, v): - if self.deleted_utc != 0 and not (v and (v.admin_level >= 2 or v.id == self.author.id)): return "[Deleted by user]" - if self.is_banned and not (v and v.admin_level >= 2): return "[Removed by admins]" + if self.deleted_utc != 0 and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or v.id == self.author.id)): return "[Deleted by user]" + if self.is_banned and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']): return "[Removed by admins]" if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{CC} ONLY

" body = self.body diff --git a/files/helpers/const.py b/files/helpers/const.py index 8954d6632..be6891b77 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -127,6 +127,7 @@ PERMS = { # Minimum admin_level to perform action. 'USER_BLOCKS_VISIBLE': 0, 'USER_FOLLOWS_VISIBLE': 0, 'USER_VOTERS_VISIBLE': 0, + 'POST_COMMENT_MODERATION': 2, } FEATURES = { diff --git a/files/routes/admin.py b/files/routes/admin.py index 24aee6acf..53262adbc 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -353,7 +353,7 @@ def shadowbanned(v): @app.get("/admin/image_posts") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def image_posts_listing(v): try: page = int(request.values.get('page', 1)) @@ -371,7 +371,7 @@ def image_posts_listing(v): @app.get("/admin/reported/posts") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def reported_posts(v): page = max(1, int(request.values.get("page", 1))) @@ -392,7 +392,7 @@ def reported_posts(v): @app.get("/admin/reported/comments") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def reported_comments(v): page = max(1, int(request.values.get("page", 1))) @@ -783,7 +783,7 @@ def admin_link_accounts(v): @app.get("/admin/removed/posts") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def admin_removed(v): try: page = int(request.values.get("page", 1)) @@ -810,7 +810,7 @@ def admin_removed(v): @app.get("/admin/removed/comments") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def admin_removed_comments(v): try: page = int(request.values.get("page", 1)) @@ -1112,7 +1112,7 @@ def mute_user(v, user_id, mute_status): @app.post("/remove_post/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def remove_post(post_id, v): post = get_post(post_id) post.is_banned = True @@ -1144,7 +1144,7 @@ def remove_post(post_id, v): @app.post("/approve_post/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def approve_post(post_id, v): post = get_post(post_id) @@ -1179,7 +1179,7 @@ def approve_post(post_id, v): def distinguish_post(post_id, v): post = get_post(post_id) - if post.author_id != v.id and v.admin_level < 2 : abort(403) + if post.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']: abort(403) if post.distinguish_level: post.distinguish_level = 0 @@ -1203,7 +1203,7 @@ def distinguish_post(post_id, v): @app.post("/sticky/") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def sticky_post(post_id, v): if not FEATURES['PINS']: abort(403) @@ -1233,7 +1233,7 @@ def sticky_post(post_id, v): return {"message": "Post pinned!"} @app.post("/unsticky/") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def unsticky_post(post_id, v): post = get_post(post_id) @@ -1258,7 +1258,7 @@ def unsticky_post(post_id, v): return {"message": "Post unpinned!"} @app.post("/sticky_comment/") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def sticky_comment(cid, v): comment = get_comment(cid, v=v) @@ -1282,7 +1282,7 @@ def sticky_comment(cid, v): @app.post("/unsticky_comment/") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def unsticky_comment(cid, v): comment = get_comment(cid, v=v) @@ -1309,7 +1309,7 @@ def unsticky_comment(cid, v): @app.post("/remove_comment/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def remove_comment(c_id, v): comment = get_comment(c_id) @@ -1329,7 +1329,7 @@ def remove_comment(c_id, v): @app.post("/approve_comment/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def approve_comment(c_id, v): comment = get_comment(c_id) diff --git a/files/routes/chat.py b/files/routes/chat.py index f26f32ab8..9b2085366 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -153,7 +153,7 @@ def typing_indicator(data, v): @socketio.on('delete') -@admin_level_required(2) +@admin_level_required(PERMS['POST_COMMENT_MODERATION']) def delete(text, v): for message in messages: diff --git a/files/routes/comments.py b/files/routes/comments.py index 666059d5f..4d05c8d1d 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -914,7 +914,7 @@ def handle_wordle_action(cid, v): def toggle_comment_nsfw(cid, v): comment = get_comment(cid) - if comment.author_id != v.id and not v.admin_level > 1 and not (comment.post.sub and v.mods(comment.post.sub)): + if comment.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (comment.post.sub and v.mods(comment.post.sub)): abort(403) if comment.over_18 and v.is_suspended_permanently: @@ -924,7 +924,7 @@ def toggle_comment_nsfw(cid, v): g.db.add(comment) if comment.author_id != v.id: - if v.admin_level > 2: + if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: ma = ModAction( kind = "set_nsfw_comment" if comment.over_18 else "unset_nsfw_comment", user_id = v.id, diff --git a/files/routes/posts.py b/files/routes/posts.py index 654cb8dcc..73223a2a2 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -35,7 +35,7 @@ def toggle_club(pid, v): abort(403) post = get_post(pid) - if post.author_id != v.id and v.admin_level < 2: abort(403) + if post.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']: abort(403) post.club = not post.club g.db.add(post) @@ -222,7 +222,7 @@ def post_id(pid, anything=None, v=None, sub=None): template = "submission.html" if (post.is_banned or post.author.shadowbanned) \ - and not (v and (v.admin_level >= 2 or post.author_id == v.id)): + and not (v and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or post.author_id == v.id)): template = "submission_banned.html" return render_template(template, v=v, p=post, ids=list(ids), @@ -378,7 +378,7 @@ def edit_post(pid, v): body = sanitize_raw_body(request.values.get("body", "")) - if v.id != p.author_id and v.admin_level < 2: + if v.id != p.author_id and v.admin_level < PERMS['POST_COMMENT_MODERATION']: abort(403) if v.id == p.author_id: @@ -1097,7 +1097,7 @@ def undelete_post_pid(pid, v): def toggle_post_nsfw(pid, v): post = get_post(pid) - if post.author_id != v.id and not v.admin_level > 1 and not (post.sub and v.mods(post.sub)): + if post.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (post.sub and v.mods(post.sub)): abort(403) if post.over_18 and v.is_suspended_permanently: @@ -1107,7 +1107,7 @@ def toggle_post_nsfw(pid, v): g.db.add(post) if post.author_id != v.id: - if v.admin_level > 2: + if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: ma = ModAction( kind = "set_nsfw" if post.over_18 else "unset_nsfw", user_id = v.id, diff --git a/files/templates/comments.html b/files/templates/comments.html index 118f6ffb6..7ba1dbf55 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -28,7 +28,7 @@ {% endif %} {% endif %} -{% if c.is_blocking and not c.ghost or (c.is_banned or c.deleted_utc) and not (v and v.admin_level > 1) and not (v and v.id==c.author_id) %} +{% if c.is_blocking and not c.ghost or (c.is_banned or c.deleted_utc) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id==c.author_id) %}
@@ -298,7 +298,7 @@
  • - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} @@ -446,7 +446,7 @@ {% if c.post %} {% set url = "" %} -{% if v.admin_level > 1%} +{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} {% set url = "sticky_comment" %} {% elif v.id == c.post.author_id %} {% set url = "pin_comment" %} @@ -462,7 +462,7 @@ {% endif %} -{% if v.admin_level > 1 %} +{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} {% if "/reported/" in request.path %} @@ -480,7 +480,7 @@ {% endif %} {% endif %} -{% if c.parent_submission and (c.author_id==v.id or v.admin_level > 1 or (c.post.sub and v.mods(c.post.sub))) %} +{% if c.parent_submission and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %} {% endif %} @@ -653,7 +653,7 @@ Unmark +18 {% endif %} - {% if v.admin_level < 2 %} + {% if v.admin_level < PERMS['POST_COMMENT_MODERATION'] %} {% if c.post and v.id == c.post.author_id %} Pin Unpin diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 25a390100..e2a94d6a9 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -45,7 +45,7 @@ Undistinguish {% endif %} - {% if v.admin_level > 1 %} + {% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} Pin Unpin {% endif %} @@ -60,7 +60,7 @@ Unmark club {% endif %} - {% if v.admin_level > 1 %} + {% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} {% if "/reported/" in request.path %} {% if v.id != p.author.id %}Remove{% endif %} Approve @@ -93,7 +93,7 @@ {% endif %} - {% if v.id==p.author_id or v.admin_level > 1 or (p.sub and v.mods(p.sub)) %} + {% if v.id==p.author_id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (p.sub and v.mods(p.sub)) %} Mark +18 Unmark +18 {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 4e7f70472..4867f5ae4 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -11,7 +11,7 @@ {% set voted=-2 %} {% endif %} -{% set v_forbid_deleted = (p.deleted_utc != 0) and not (v and v.admin_level >= 2) and not (v and v.id == p.author_id) %} +{% set v_forbid_deleted = (p.deleted_utc != 0) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id == p.author_id) %} {% block title %} diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index 773d4fcfe..bc4736bc6 100644 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -43,7 +43,7 @@
- {% if v and v.admin_level > 1 and p.body_html %} + {% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and p.body_html %}
{{p.body_html | safe}}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 218d2b766..c0024976b 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -28,7 +28,7 @@ {% set voted=-2 %} {% endif %} -{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= 2) and not (v and v.id == p.author_id) %} +{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id == p.author_id) %} {% if p.active_flags(v) %}
From 0dfff1f4f6fabcfaa7e12f01544fb1c86535f57c Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 18:03:23 -0700 Subject: [PATCH 02/81] editing posts to JL3 (will be constantified soon) --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 73223a2a2..af5fc14c3 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -378,7 +378,7 @@ def edit_post(pid, v): body = sanitize_raw_body(request.values.get("body", "")) - if v.id != p.author_id and v.admin_level < PERMS['POST_COMMENT_MODERATION']: + if v.id != p.author_id and v.admin_level < 3: abort(403) if v.id == p.author_id: From 4b78ed176a7b45abf6c15174a6d0008d55c360ea Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 18:16:52 -0700 Subject: [PATCH 03/81] global moderation perm and add some more checks for const perm --- files/classes/user.py | 2 +- files/helpers/const.py | 1 + files/routes/reporting.py | 4 ++-- files/routes/users.py | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 12aed3b0f..1102eec37 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -319,7 +319,7 @@ class User(Base): @lazy def mod_date(self, sub): - if self.admin_level >= 3: return 1 + if self.admin_level >= PERMS['GLOBAL_HOLE_MODERATION']: return 1 mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none() if not mod: return None return mod.created_utc diff --git a/files/helpers/const.py b/files/helpers/const.py index be6891b77..fa09dc1b0 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -128,6 +128,7 @@ PERMS = { # Minimum admin_level to perform action. 'USER_FOLLOWS_VISIBLE': 0, 'USER_VOTERS_VISIBLE': 0, 'POST_COMMENT_MODERATION': 2, + 'GLOBAL_HOLE_MODERATION': 3, } FEATURES = { diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 4b965faf0..e72f47a49 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -30,7 +30,7 @@ def flag_post(pid, v): if len(reason) > 350: return {"error": "Too long."}, 400 - if reason.startswith('!') and (v.admin_level > 1 or post.sub and v.mods(post.sub)): + if reason.startswith('!') and (v.admin_level > PERMS['POST_COMMENT_MODERATION'] or post.sub and v.mods(post.sub)): post.flair = reason[1:] g.db.add(post) if v.admin_level > 1: @@ -51,7 +51,7 @@ def flag_post(pid, v): ) g.db.add(ma) - elif reason.startswith('/h/') and (v.admin_level >= 2 or v.id == post.author_id or (reason == '/h/chudrama' and v.mods(post.sub))): + elif reason.startswith('/h/') and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or v.id == post.author_id or (reason == '/h/chudrama' and v.mods(post.sub))): sub_from = post.sub sub_to = reason[3:].strip().lower() diff --git a/files/routes/users.py b/files/routes/users.py index 54aa674ab..cb87b5026 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1141,14 +1141,14 @@ def u_username_comments(username, v=None): Comment.parent_submission != None ) - if not v or (v.id != u.id and v.admin_level < 2): + if not v or (v.id != u.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']): comments = comments.filter( Comment.is_banned == False, Comment.ghost == False, comment_post_author.shadowbanned == None ) - if not (v and v.admin_level > 1): + if not (v and v.admin_level > PERMS['POST_COMMENT_MODERATION']): comments = comments.filter(Comment.deleted_utc == 0) comments = apply_time_filter(t, comments, Comment) From 591e6342bbbedaa01242f3e8588abdcba0d523bf Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 18:24:37 -0700 Subject: [PATCH 04/81] editing permissions --- files/helpers/const.py | 1 + files/routes/posts.py | 5 ++--- files/templates/submission.html | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index fa09dc1b0..1accfe843 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -129,6 +129,7 @@ PERMS = { # Minimum admin_level to perform action. 'USER_VOTERS_VISIBLE': 0, 'POST_COMMENT_MODERATION': 2, 'GLOBAL_HOLE_MODERATION': 3, + 'POST_EDITING': 3, } FEATURES = { diff --git a/files/routes/posts.py b/files/routes/posts.py index af5fc14c3..b58a03214 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -373,14 +373,13 @@ def morecomments(v, cid): @auth_required def edit_post(pid, v): p = get_post(pid) + if v.id != p.author_id and v.admin_level < PERMS['POST_EDITING']: + abort(403) title = sanitize_raw_title(request.values.get("title", "")) body = sanitize_raw_body(request.values.get("body", "")) - if v.id != p.author_id and v.admin_level < 3: - abort(403) - if v.id == p.author_id: if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')): return {"error":"You have to type more than 280 characters!"}, 403 diff --git a/files/templates/submission.html b/files/templates/submission.html index 4867f5ae4..e0b7d9d41 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -790,7 +790,7 @@
{% endif %} - {% if v and (v.id==p.author_id or v.admin_level > 2) and not v.is_suspended %} + {% if v and (v.id==p.author_id or v.admin_level >= PERMS['POST_EDITING']) and not v.is_suspended %}

 						

-						{% if u.is_suspended %}
-							
-								
-								
-								
-							
-						{% else %}
-							
- - - - -
- - -
- -
+ {% if v.admin_level >= PERMS['USER_BAN'] %} + {% if u.is_suspended %} +
+ + + +
+ {% else %} +
+ + + + +
+ + +
+ +
+ {% endif %} {% endif %}

 						


From 35c294b421c57490d712a22a135bc63dc7236d9b Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:24:27 -0700
Subject: [PATCH 06/81] shadowban perms and some more fixes

---
 files/classes/user.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/files/classes/user.py b/files/classes/user.py
index 1ef949466..464811623 100644
--- a/files/classes/user.py
+++ b/files/classes/user.py
@@ -453,14 +453,14 @@ class User(Base):
 	@cache.memoize(timeout=86400)
 	def userpagelisting(self, site=None, v=None, page=1, sort="new", t="all"):
 
-		if self.shadowbanned and not (v and (v.admin_level > 1 or v.id == self.id)): return []
+		if self.shadowbanned and not (v and (v.admin_level >= PERMS['USER_SHADOWBAN'] or v.id == self.id)): return []
 
 		posts = g.db.query(Submission.id).filter_by(author_id=self.id, is_pinned=False)
 
-		if not (v and (v.admin_level > 1 or v.id == self.id)):
+		if not (v and (v.admin_level > PERMS['POST_COMMENT_MODERATION'] or v.id == self.id)):
 			posts = posts.filter_by(is_banned=False, private=False, ghost=False)
 
-		if not (v and v.admin_level > 1):
+		if not (v and v.admin_level > PERMS['POST_COMMENT_MODERATION']):
 			posts = posts.filter_by(deleted_utc=0)
 
 		posts = apply_time_filter(t, posts, Submission)
@@ -592,7 +592,7 @@ class User(Base):
 			Notification.user_id == self.id, Notification.read == False, 
 			Comment.is_banned == False, Comment.deleted_utc == 0)
 		
-		if not self.shadowbanned and self.admin_level < 3:
+		if not self.shadowbanned and self.admin_level < PERMS['USER_SHADOWBAN']:
 			notifs = notifs.join(Comment.author).filter(User.shadowbanned == None)
 		
 		return notifs.count() + self.post_notifications_count + self.modaction_notifications_count
@@ -617,7 +617,7 @@ class User(Base):
 					Comment.parent_submission == None,
 				)
 
-		if not self.shadowbanned and self.admin_level < 3:
+		if not self.shadowbanned and self.admin_level < PERMS['USER_SHADOWBAN']:
 			notifs = notifs.join(Comment.author).filter(User.shadowbanned == None)
 
 		return notifs.count()
@@ -774,8 +774,8 @@ class User(Base):
 				'bannerurl': self.banner_url,
 				'bio_html': self.bio_html_eager,
 				'coins': self.coins,
-				'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= 2)) else self.post_count,
-				'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= 2)) else self.comment_count,
+				'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= PERMS['USER_SHADOWBAN'])) else self.post_count,
+				'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level >= PERMS['USER_SHADOWBAN'])) else self.comment_count,
 				'badges': [x.path for x in self.badges],
 				}
 

From 2fc3044d5b8e0455cd82f6035b92c2f2a35ca844 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:24:37 -0700
Subject: [PATCH 07/81] shadowban perms and stuff

---
 files/helpers/const.py                        |   1 +
 files/helpers/get.py                          |   4 +-
 files/routes/admin.py                         |   2 +-
 files/routes/awards.py                        |   2 +-
 files/routes/comments.py                      |   6 +-
 files/routes/front.py                         |   2 +-
 files/routes/notifications.py                 |   2 +-
 files/routes/posts.py                         |   2 +-
 files/routes/reporting.py                     |   2 +-
 files/routes/search.py                        |   2 +-
 files/routes/static.py                        |   2 +-
 files/templates/comments.html                 |   6 +-
 .../templates/post_admin_actions_mobile.html  |   2 +-
 files/templates/submission.html               |   2 +-
 files/templates/submission_listing.html       |   2 +-
 files/templates/userpage.html                 | 105 +++++++++---------
 16 files changed, 75 insertions(+), 69 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 1ba562fad..12375f46b 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -131,6 +131,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'GLOBAL_HOLE_MODERATION': 3,
 	'POST_EDITING': 3,
 	'USER_BAN': 2,
+	'USER_SHADOWBAN': 2,
 }
 
 FEATURES = {
diff --git a/files/helpers/get.py b/files/helpers/get.py
index 8ebd3a4dc..084275ad1 100644
--- a/files/helpers/get.py
+++ b/files/helpers/get.py
@@ -39,7 +39,7 @@ def get_user(username, v=None, graceful=False, rendered=False, include_blocks=Fa
 
 	user = user.one_or_none()
 
-	if not user or (user.shadowbanned and not (include_shadowbanned or (v and (v.admin_level >= 2 or v.shadowbanned)))):
+	if not user or (user.shadowbanned and not (include_shadowbanned or (v and (v.admin_level >= PERMS['USER_SHADOWBAN'] or v.shadowbanned)))):
 		if not graceful: abort(404)
 		else: return None
 
@@ -264,7 +264,7 @@ def get_comments(cids, v=None, load_parent=False):
 			blocked.c.target_id,
 		).filter(Comment.id.in_(cids))
  
-		if not (v and (v.shadowbanned or v.admin_level >= 2)):
+		if not (v and (v.shadowbanned or v.admin_level >= PERMS['USER_SHADOWBAN'])):
 			comments = comments.join(Comment.author).filter(User.shadowbanned == None)
 
 		comments = comments.join(
diff --git a/files/routes/admin.py b/files/routes/admin.py
index c1bc9e96a..679d87a48 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -347,7 +347,7 @@ def club_ban(v, username):
 @app.get("/admin/shadowbanned")
 @auth_required
 def shadowbanned(v):
-	if not (v and v.admin_level > 1): abort(404)
+	if not (v and v.admin_level >= PERMS['USER_SHADOWBAN']): abort(404)
 	users = g.db.query(User).filter(User.shadowbanned != None).order_by(User.shadowbanned).all()
 	return render_template("shadowbanned.html", v=v, users=users)
 
diff --git a/files/routes/awards.py b/files/routes/awards.py
index e94e36fd4..2271bd969 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -249,7 +249,7 @@ def award_thing(v, thing_type, id):
 		author.unban_utc = int(time.time()) + 30 * 86400
 		send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
 
-		if v.admin_level > 2:
+		if v.admin_level >= PERMS['USER_BAN']:
 			log_link = f'/{thing_type}/{thing.id}'
 			reason = f'{log_link}'
 
diff --git a/files/routes/comments.py b/files/routes/comments.py
index 4e1aaebf5..ce52a74f4 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -41,7 +41,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
 
 	if not comment.can_see(v): abort(403)
 	
-	if comment.author.shadowbanned and not (v and v.shadowbanned) and not (v and v.admin_level >= 2):
+	if comment.author.shadowbanned and not (v and v.shadowbanned) and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']):
 		abort(404)
 
 	if v and request.values.get("read"):
@@ -52,7 +52,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
 
 	if comment.post and comment.post.club and not (v and (v.paid_dues or v.id in [comment.author_id, comment.post.author_id])): abort(403)
 
-	if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level > 1) : abort(403)
+	if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) : abort(403)
 	
 	if not pid:
 		if comment.parent_submission: pid = comment.parent_submission
@@ -96,7 +96,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
 			blocked.c.target_id,
 		)
 
-		if not (v and v.shadowbanned) and not (v and v.admin_level >= 2):
+		if not (v and v.shadowbanned) and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']):
 			comments = comments.join(Comment.author).filter(User.shadowbanned == None)
 		 
 		comments=comments.filter(
diff --git a/files/routes/front.py b/files/routes/front.py
index 6e5900b9e..ee9de5134 100644
--- a/files/routes/front.py
+++ b/files/routes/front.py
@@ -239,7 +239,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0,
 
 	comments = g.db.query(Comment.id).filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
 
-	if v.admin_level < 2:
+	if v.admin_level < PERMS['POST_COMMENT_MODERATION']:
 		private = [x[0] for x in g.db.query(Submission.id).filter(Submission.private == True).all()]
 
 		comments = comments.filter(Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private))
diff --git a/files/routes/notifications.py b/files/routes/notifications.py
index e483508ac..2ac12f904 100644
--- a/files/routes/notifications.py
+++ b/files/routes/notifications.py
@@ -258,7 +258,7 @@ def notifications(v):
 		or_(Comment.sentto == None, Comment.sentto == 2),
 	).order_by(Notification.created_utc.desc())
 
-	if not (v and (v.shadowbanned or v.admin_level > 2)):
+	if not (v and (v.shadowbanned or v.admin_level >= 3)):
 		comments = comments.join(Comment.author).filter(User.shadowbanned == None)
 
 	comments = comments.offset(25 * (page - 1)).limit(26).all()
diff --git a/files/routes/posts.py b/files/routes/posts.py
index b58a03214..14962181a 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -132,7 +132,7 @@ def post_id(pid, anything=None, v=None, sub=None):
 			blocked.c.target_id,
 		)
 		
-		if not (v and v.shadowbanned) and not (v and v.admin_level >= 2):
+		if not (v and v.shadowbanned) and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']):
 			comments = comments.join(Comment.author).filter(User.shadowbanned == None)
  
 		comments=comments.filter(Comment.parent_submission == post.id, Comment.level < 10).join(
diff --git a/files/routes/reporting.py b/files/routes/reporting.py
index 962da38f0..ec0546105 100644
--- a/files/routes/reporting.py
+++ b/files/routes/reporting.py
@@ -95,7 +95,7 @@ def flag_post(pid, v):
 				g.db.add(ma)
 
 		if v.id != post.author_id:
-			if v.admin_level >= 3: position = 'Admin'
+			if v.admin_level >= PERMS['POST_COMMENT_MODERATION']: position = 'Admin'
 			else: position = 'Mod'
 			message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) to /h/{post.sub}"
 			send_repeatable_notification(post.author_id, message)
diff --git a/files/routes/search.py b/files/routes/search.py
index 5c325d1ef..616bbcb34 100644
--- a/files/routes/search.py
+++ b/files/routes/search.py
@@ -282,7 +282,7 @@ def searchusers(v):
 		)
 	)
 	
-	if v.admin_level < 2:
+	if v.admin_level < PERMS['USER_SHADOWBAN']:
 		users = users.filter(User.shadowbanned == None)
 
 	users=users.order_by(User.username.ilike(term).desc(), User.stored_subscriber_count.desc())
diff --git a/files/routes/static.py b/files/routes/static.py
index ee5435919..3acad856c 100644
--- a/files/routes/static.py
+++ b/files/routes/static.py
@@ -148,7 +148,7 @@ def log(v):
 		actions = []
 	else:
 		actions = g.db.query(ModAction)
-		if not (v and v.admin_level >= 2): 
+		if not (v and v.admin_level >= PERMS['USER_SHADOWBAN']): 
 			actions = actions.filter(ModAction.kind.notin_(["shadowban","unshadowban"]))
 
 		if admin_id:
diff --git a/files/templates/comments.html b/files/templates/comments.html
index 7779916c2..18618c3a4 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -21,7 +21,7 @@
 {% set score=ups-downs %}
 
 {% if render_replies %}
-	{% if v and (v.shadowbanned or v.admin_level >= 2) %}
+	{% if v and (v.shadowbanned or v.admin_level >= PERMS['USER_SHADOWBAN']) %}
 		{% set replies=c.replies3(sort) %}
 	{% else %}
 		{% set replies=c.replies(sort) %}
@@ -140,7 +140,7 @@
 				{% endif %}
 				{% if c.active_flags(v) %}{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}{% endif %}
 				{% if c.over_18 %}+18{% endif %}
-				{% if v and v.admin_level > 1 and c.author.shadowbanned %}{% endif %}
+				{% if v and v.admin_level >= PERMS['USER_SHADOWBAN'] and c.author.shadowbanned %}{% endif %}
 				{% if c.stickied %}
 					
 				{% endif %}
@@ -485,7 +485,7 @@
 	
 {% endif %}
 
-{% if v.admin_level > 1 and v.id != c.author_id %}
+{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
 
 
 {% endif %}
diff --git a/files/templates/post_admin_actions_mobile.html b/files/templates/post_admin_actions_mobile.html
index bb794e2ef..ee568c0b9 100644
--- a/files/templates/post_admin_actions_mobile.html
+++ b/files/templates/post_admin_actions_mobile.html
@@ -9,7 +9,7 @@
 			
 			
 						

 						

-						{% if u.is_suspended %}
-							
- - - -
- {% else %} -
- - - - -
- - -
- -
+ {% if v.admin_level >= PERMS['USER_BAN']} + {% if u.is_suspended %} +
+ + + +
+ {% else %} +
+ + + + +
+ + +
+ +
+ {% endif %} {% endif %}

 						

-
-						{% if u.shadowbanned %}
-							
- - -
- {% else %} -
- - -
- - -
- -
+ {% if v.admin_level >= PERMS['USER_SHADOWBAN']} + {% if u.shadowbanned %} +
+ + +
+ {% else %} +
+ + +
+ + +
+ +
+ {% endif %} {% endif %}

 						


From d8610b34b64a9117de8f22703313eaf3d45fbbc1 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:45:05 -0700
Subject: [PATCH 08/81] changelog permission and don't query db for badges if
 admin with perm level

---
 files/helpers/const.py |  1 +
 files/routes/posts.py  | 11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 12375f46b..9fac66ec8 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -132,6 +132,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'POST_EDITING': 3,
 	'USER_BAN': 2,
 	'USER_SHADOWBAN': 2,
+	'POST_TO_CHANGELOG': 1,
 }
 
 FEATURES = {
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 14962181a..7be3690c3 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -70,8 +70,7 @@ def publish(pid, v):
 	cache.delete_memoized(frontlist)
 	cache.delete_memoized(User.userpagelisting)
 
-	if (v.admin_level > 0 or v.has_badge(3)) and post.sub == 'changelog':
-		send_changelog_message(post.permalink)
+	send_changelog_message(post.permalink)
 
 	if SITE == 'watchpeopledie.co':
 		send_wpd_message(post.permalink)
@@ -681,7 +680,11 @@ def submit_post(v, sub=None):
 	sub = request.values.get("sub", "").lower().replace('/h/','').strip()
 
 	if sub == 'changelog':
-		allowed = g.db.query(User.id).filter(User.admin_level > 0).all() + g.db.query(Badge.user_id).filter_by(badge_id=3).all()
+		allowed = []
+		if v.admin_level >= PERMS['POST_TO_CHANGELOG']:
+			allowed.append(v.id)
+		if v.id not in allowed: # only query for badges if doesn't have permissions (this is a bit weird tbh)
+			allowed = g.db.query(Badge.user_id).filter_by(badge_id=3).all()
 		allowed = [x[0] for x in allowed]
 		if v.id not in allowed: return error(f"You don't have sufficient permissions to post in /h/changelog")
 
@@ -1030,7 +1033,7 @@ def submit_post(v, sub=None):
 	cache.delete_memoized(frontlist)
 	cache.delete_memoized(User.userpagelisting)
 
-	if (v.admin_level > 0 or v.has_badge(3)) and post.sub == 'changelog' and not post.private:
+	if post.sub == 'changelog' and not post.private:
 		send_changelog_message(post.permalink)
 
 	if not post.private and SITE == 'watchpeopledie.co':

From 43f137208a3daa480da3260da3747d6a1024d353 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:51:30 -0700
Subject: [PATCH 09/81] bypass pin limit perm and also fix a shadowban perm

---
 files/helpers/const.py | 1 +
 files/routes/posts.py  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 9fac66ec8..a9e77d430 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -133,6 +133,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'USER_BAN': 2,
 	'USER_SHADOWBAN': 2,
 	'POST_TO_CHANGELOG': 1,
+	'BYPASS_PIN_LIMIT': 3,
 }
 
 FEATURES = {
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 7be3690c3..4ea80600a 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -253,7 +253,7 @@ def viewmore(v, pid, sort, offset):
 			blocked.c.target_id,
 		).filter(Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
 		
-		if not (v and v.shadowbanned) and not (v and v.admin_level >= 2):
+		if not (v and v.shadowbanned) and not (v and v.admin_level >= PERMS['USER_SHADOWBAN']):
 			comments = comments.join(Comment.author).filter(User.shadowbanned == None)
  
 		comments=comments.join(

From ae0c215af3834a67599fab3d492a9eead5e10c66 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:51:44 -0700
Subject: [PATCH 10/81] ...

---
 files/helpers/get.py  | 2 +-
 files/routes/admin.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/files/helpers/get.py b/files/helpers/get.py
index 084275ad1..58710d4a9 100644
--- a/files/helpers/get.py
+++ b/files/helpers/get.py
@@ -95,7 +95,7 @@ def get_account(id, v=None, graceful=False, include_blocks=False, include_shadow
 
 	user = g.db.get(User, id)
 
-	if not user or (user.shadowbanned and not (include_shadowbanned or (v and (v.admin_level >= 2 or v.shadowbanned)))):
+	if not user or (user.shadowbanned and not (include_shadowbanned or (v and (v.admin_level >= PERMS['USER_SHADOWBAN'] or v.shadowbanned)))):
 		if not graceful: abort(404)
 		else: return None
 
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 679d87a48..7791e1f24 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -1212,7 +1212,7 @@ def sticky_post(post_id, v):
 	if not post.stickied:
 		pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count()
 		if pins >= PIN_LIMIT:
-			if v.admin_level > 2:
+			if v.admin_level > PERMS['BYPASS_PIN_LIMIT']:
 				post.stickied = v.username
 				post.stickied_utc = int(time.time()) + 3600
 			else: return {"error": f"Can't exceed {PIN_LIMIT} pinned posts limit!"}, 403

From 0349862531bb285b169f1cb976c33be195fefb5a Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:55:54 -0700
Subject: [PATCH 11/81] view pending submitted marseys and hats perms

---
 files/helpers/const.py            |  2 ++
 files/routes/asset_submissions.py | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index a9e77d430..edf44e4b8 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -134,6 +134,8 @@ PERMS = { # Minimum admin_level to perform action.
 	'USER_SHADOWBAN': 2,
 	'POST_TO_CHANGELOG': 1,
 	'BYPASS_PIN_LIMIT': 3,
+	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
+	'VIEW_PENDING_SUBMITTED_HATS': 3,
 }
 
 FEATURES = {
diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py
index b4aaf88f0..e03829e6a 100644
--- a/files/routes/asset_submissions.py
+++ b/files/routes/asset_submissions.py
@@ -22,7 +22,7 @@ def asset_submissions(path):
 @app.get("/submit/marseys")
 @auth_required
 def submit_marseys(v):
-	if v.admin_level > 2:
+	if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_MARSEYS']:
 		marseys = g.db.query(Marsey).filter(Marsey.submitter_id != None).all()
 	else:
 		marseys = g.db.query(Marsey).filter(Marsey.submitter_id == v.id).all()
@@ -44,7 +44,7 @@ def submit_marsey(v):
 	username = request.values.get('author').lower().strip()
 
 	def error(error):
-		if v.admin_level > 2: marseys = g.db.query(Marsey).filter(Marsey.submitter_id != None).all()
+		if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_MARSEYS']: marseys = g.db.query(Marsey).filter(Marsey.submitter_id != None).all()
 		else: marseys = g.db.query(Marsey).filter(Marsey.submitter_id == v.id).all()
 		for marsey in marseys:
 			marsey.author = g.db.query(User.username).filter_by(id=marsey.author_id).one()[0]
@@ -82,7 +82,7 @@ def submit_marsey(v):
 	g.db.add(marsey)
 
 	g.db.flush()
-	if v.admin_level > 2: marseys = g.db.query(Marsey).filter(Marsey.submitter_id != None).all()
+	if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_MARSEYS']: marseys = g.db.query(Marsey).filter(Marsey.submitter_id != None).all()
 	else: marseys = g.db.query(Marsey).filter(Marsey.submitter_id == v.id).all()
 	for marsey in marseys:
 		marsey.author = g.db.query(User.username).filter_by(id=marsey.author_id).one()[0]
@@ -186,7 +186,7 @@ def remove_marsey(v, name):
 @app.get("/submit/hats")
 @auth_required
 def submit_hats(v):
-	if v.admin_level > 2: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
+	if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_HATS']: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
 	else: hats = g.db.query(HatDef).filter(HatDef.submitter_id == v.id).all()
 	return render_template("submit_hats.html", v=v, hats=hats)
 
@@ -200,7 +200,7 @@ def submit_hat(v):
 	username = request.values.get('author').strip()
 
 	def error(error):
-		if v.admin_level > 2: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
+		if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_HATS']: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
 		else: hats = g.db.query(HatDef).filter(HatDef.submitter_id == v.id).all()
 		return render_template("submit_hats.html", v=v, hats=hats, error=error, name=name, description=description, username=username), 400
 
@@ -245,7 +245,7 @@ def submit_hat(v):
 
 	g.db.commit()
 
-	if v.admin_level > 2: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
+	if v.admin_level >= PERMS['VIEW_PENDING_SUBMITTED_HATS']: hats = g.db.query(HatDef).filter(HatDef.submitter_id != None).all()
 	else: hats = g.db.query(HatDef).filter(HatDef.submitter_id == v.id).all()
 	return render_template("submit_hats.html", v=v, hats=hats, msg=f"'{name}' submitted successfully!")
 

From 970a7adfbdf4a78aec88bb265d087e244d8907b0 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 19:57:31 -0700
Subject: [PATCH 12/81] buy ghost award permission

---
 files/helpers/const.py | 1 +
 files/routes/awards.py | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index edf44e4b8..1b72280f1 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -136,6 +136,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'BYPASS_PIN_LIMIT': 3,
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
 	'VIEW_PENDING_SUBMITTED_HATS': 3,
+	'BUY_GHOST_AWARD': 2,
 }
 
 FEATURES = {
diff --git a/files/routes/awards.py b/files/routes/awards.py
index 2271bd969..28f4829c4 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -51,7 +51,7 @@ def buy(v, award):
 	if award == 'benefactor' and not request.values.get("mb"):
 		return {"error": "You can only buy the Benefactor award with marseybux."}, 403
 
-	if award == 'ghost' and v.admin_level < 2:
+	if award == 'ghost' and v.admin_level < PERMS['BUY_GHOST_AWARD']:
 		return {"error": "Only admins can buy this award."}, 403
 
 	AWARDS = deepcopy(AWARDS2)

From f5996afc5a1689d35ea78067000b18322ea7e788 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:04:38 -0700
Subject: [PATCH 13/81] add some perm requirements and add agendaposter thing

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 8 ++++----
 files/routes/awards.py | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 1b72280f1..fbc2d766c 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -132,6 +132,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'POST_EDITING': 3,
 	'USER_BAN': 2,
 	'USER_SHADOWBAN': 2,
+	'USER_AGENDAPOSTER': 2,
 	'POST_TO_CHANGELOG': 1,
 	'BYPASS_PIN_LIMIT': 3,
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 7791e1f24..2364781cf 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -835,7 +835,7 @@ def admin_removed_comments(v):
 
 
 @app.post("/agendaposter/")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_AGENDAPOSTER'])
 def agendaposter(user_id, v):
 	user = get_account(user_id)
 
@@ -869,7 +869,7 @@ def agendaposter(user_id, v):
 
 
 @app.post("/unagendaposter/")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_AGENDAPOSTER'])
 def unagendaposter(user_id, v):
 	user = get_account(user_id)
 
@@ -898,7 +898,7 @@ def unagendaposter(user_id, v):
 
 @app.post("/shadowban/")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_SHADOWBAN'])
 def shadowban(user_id, v):
 	user = get_account(user_id)
 	if user.admin_level != 0: abort(403)
@@ -928,7 +928,7 @@ def shadowban(user_id, v):
 
 @app.post("/unshadowban/")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_SHADOWBAN'])
 def unshadowban(user_id, v):
 	user = get_account(user_id)
 	user.shadowbanned = None
diff --git a/files/routes/awards.py b/files/routes/awards.py
index 28f4829c4..5e43fcd1f 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -297,7 +297,7 @@ def award_thing(v, thing_type, id):
 		
 		badge_grant(user=author, badge_id=28)
 
-		if v.admin_level > 2:
+		if v.admin_level >= PERMS['USER_AGENDAPOSTER']:
 			ma = ModAction(
 				kind="agendaposter",
 				user_id=v.id,

From d709334180030fcea03b75bf93d6df2f0c65039c Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:09:20 -0700
Subject: [PATCH 14/81] lottery permissions

---
 files/helpers/const.py  | 2 ++
 files/routes/lottery.py | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index fbc2d766c..39db2e7f1 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -138,6 +138,8 @@ PERMS = { # Minimum admin_level to perform action.
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
 	'VIEW_PENDING_SUBMITTED_HATS': 3,
 	'BUY_GHOST_AWARD': 2,
+	'LOTTERY_ADMIN': 3,
+	'LOTTERY_VIEW_PARTICIPANTS': 2,
 }
 
 FEATURES = {
diff --git a/files/routes/lottery.py b/files/routes/lottery.py
index dfb87d207..3546d1517 100644
--- a/files/routes/lottery.py
+++ b/files/routes/lottery.py
@@ -8,7 +8,7 @@ from files.helpers.lottery import *
 import requests
 
 @app.post("/lottery/end")
-@admin_level_required(3)
+@admin_level_required(PERMS['LOTTERY_ADMIN'])
 @casino_required
 def lottery_end(v):
 	success, message = end_lottery_session()
@@ -16,7 +16,7 @@ def lottery_end(v):
 
 
 @app.post("/lottery/start")
-@admin_level_required(3)
+@admin_level_required(PERMS['LOTTERY_ADMIN'])
 @casino_required
 def lottery_start(v):
 	start_new_lottery_session()
@@ -51,7 +51,7 @@ def lottery_active(v):
 	return {"message": "", "stats": {"user": v.lottery_stats, "lottery": lottery, "participants": participants}}
 
 @app.get("/admin/lottery/participants")
-@admin_level_required(2)
+@admin_level_required(PERMS['LOTTERY_VIEW_PARTICIPANTS'])
 @casino_required
 def lottery_admin(v):
 	participants = get_users_participating_in_lottery()

From c2109fd61122f2d0dbfd8fdf682f3a95cfbaf86b Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:10:57 -0700
Subject: [PATCH 15/81] modmail viewing perm

---
 files/helpers/const.py        | 1 +
 files/routes/notifications.py | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 39db2e7f1..285b12450 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -140,6 +140,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'BUY_GHOST_AWARD': 2,
 	'LOTTERY_ADMIN': 3,
 	'LOTTERY_VIEW_PARTICIPANTS': 2,
+	'VIEW_MODMAIL': 2,
 }
 
 FEATURES = {
diff --git a/files/routes/notifications.py b/files/routes/notifications.py
index 2ac12f904..900f79773 100644
--- a/files/routes/notifications.py
+++ b/files/routes/notifications.py
@@ -36,7 +36,7 @@ def unread(v):
 
 
 @app.get("/notifications/modmail")
-@admin_level_required(2)
+@admin_level_required(PERMS['VIEW_MODMAIL'])
 def notifications_modmail(v):
 	try: page = max(int(request.values.get("page", 1)), 1)
 	except: page = 1

From c0f753e10158c788ea9279c780ceb6d8498f7538 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:15:10 -0700
Subject: [PATCH 16/81] asset submissions permissions

---
 files/helpers/const.py            |  4 ++++
 files/routes/asset_submissions.py | 12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 285b12450..4b10651d0 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -137,6 +137,10 @@ PERMS = { # Minimum admin_level to perform action.
 	'BYPASS_PIN_LIMIT': 3,
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
 	'VIEW_PENDING_SUBMITTED_HATS': 3,
+	'MODERATE_PENDING_SUBMITTED_MARSEYS': 3, # note: there is an extra check so that only """carp""" can approve them
+	'MODERATE_PENDING_SUBMITTED_HATS': 3, # note: there is an extra check so that only """carp""" can approve them
+	'UPDATE_MARSEYS': 3, # note: extra check is here for 4 different users
+	'UPDATE_HATS': 3, # note: extra check is here for 4 different users
 	'BUY_GHOST_AWARD': 2,
 	'LOTTERY_ADMIN': 3,
 	'LOTTERY_VIEW_PARTICIPANTS': 2,
diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py
index e03829e6a..9118b976c 100644
--- a/files/routes/asset_submissions.py
+++ b/files/routes/asset_submissions.py
@@ -92,7 +92,7 @@ def submit_marsey(v):
 
 
 @app.post("/admin/approve/marsey/")
-@admin_level_required(3)
+@admin_level_required(PERMS['MODERATE_PENDING_SUBMITTED_MARSEYS'])
 def approve_marsey(v, name):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID):
 		return {"error": "Only Carp can approve marseys!"}, 403
@@ -251,7 +251,7 @@ def submit_hat(v):
 
 
 @app.post("/admin/approve/hat/")
-@admin_level_required(3)
+@admin_level_required(PERMS['MODERATE_PENDING_SUBMITTED_HATS'])
 def approve_hat(v, name):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID):
 		return {"error": "Only Carp can approve hats!"}, 403
@@ -345,7 +345,7 @@ def remove_hat(v, name):
 
 
 @app.get("/admin/update/marseys")
-@admin_level_required(3)
+@admin_level_required(PERMS['UPDATE_MARSEYS'])
 def update_marseys(v):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
 		abort(403)
@@ -354,7 +354,7 @@ def update_marseys(v):
 
 
 @app.post("/admin/update/marseys")
-@admin_level_required(3)
+@admin_level_required(PERMS['UPDATE_MARSEYS'])
 def update_marsey(v):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
 		abort(403)
@@ -408,7 +408,7 @@ def update_marsey(v):
 
 
 @app.get("/admin/update/hats")
-@admin_level_required(3)
+@admin_level_required(PERMS['UPDATE_HATS'])
 def update_hats(v):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
 		abort(403)
@@ -417,7 +417,7 @@ def update_hats(v):
 
 
 @app.post("/admin/update/hats")
-@admin_level_required(3)
+@admin_level_required(PERMS['UPDATE_HATS'])
 def update_hat(v):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, GEESE_ID, SNAKES_ID):
 		abort(403)

From 1a0785d497ef0f649696dd772b37ca1e73f89de4 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:26:39 -0700
Subject: [PATCH 17/81] add perm for kippy's marseybux printer

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 4b10651d0..f977abd97 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -145,6 +145,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'LOTTERY_ADMIN': 3,
 	'LOTTERY_VIEW_PARTICIPANTS': 2,
 	'VIEW_MODMAIL': 2,
+	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
 }
 
 FEATURES = {
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 2364781cf..cd81a72a5 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -22,8 +22,9 @@ import requests
 from urllib.parse import quote, urlencode
 
 @app.post('/kippy')
-@admin_level_required(3)
+@admin_level_required(PERMS['PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES'])
 def kippy(v):
+	if SITE == 'rdrama.net': abort(404)
 	kippy = get_account(KIPPY_ID)
 	kippy.procoins += 10000
 	g.db.add(kippy)

From c813f52c1a87ebbb642d7c13cc1cc064b5a004c0 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:29:14 -0700
Subject: [PATCH 18/81] view active users perm

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index f977abd97..f54dd597d 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -146,6 +146,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'LOTTERY_VIEW_PARTICIPANTS': 2,
 	'VIEW_MODMAIL': 2,
 	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
+	'VIEW_ACTIVE_USERS': 2,
 }
 
 FEATURES = {
diff --git a/files/routes/admin.py b/files/routes/admin.py
index cd81a72a5..7b6f043c1 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -31,14 +31,14 @@ def kippy(v):
 	return '10k marseycoins printed!'
 
 @app.get('/admin/loggedin')
-@admin_level_required(2)
+@admin_level_required(PERMS['VIEW_ACTIVE_USERS'])
 def loggedin_list(v):
 	ids = [x for x,val in cache.get(f'{SITE}_loggedin').items() if time.time()-val < LOGGEDIN_ACTIVE_TIME]
 	users = g.db.query(User).filter(User.id.in_(ids)).order_by(User.admin_level.desc(), User.truecoins.desc()).all()
 	return render_template("loggedin.html", v=v, users=users)
 
 @app.get('/admin/loggedout')
-@admin_level_required(2)
+@admin_level_required(PERMS['VIEW_ACTIVE_USERS'])
 def loggedout_list(v):
 	users = sorted([val[1] for x,val in cache.get(f'{SITE}_loggedout').items() if time.time()-val[0] < LOGGEDIN_ACTIVE_TIME])
 	return render_template("loggedout.html", v=v, users=users)

From 3cf972ef9ae3436a2c98f959d465d11e4108d53a Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:33:23 -0700
Subject: [PATCH 19/81] merge permission

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index f54dd597d..cefd6a5e5 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -147,6 +147,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'VIEW_MODMAIL': 2,
 	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
 	'VIEW_ACTIVE_USERS': 2,
+	'MERGE_USERS': 3, # note: extra check for Aevann
 }
 
 FEATURES = {
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 7b6f043c1..668bda938 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -44,7 +44,7 @@ def loggedout_list(v):
 	return render_template("loggedout.html", v=v, users=users)
 
 @app.get('/admin/merge//')
-@admin_level_required(3)
+@admin_level_required(PERMS['MERGE_USERS'])
 def merge(v, id1, id2):
 	if v.id != AEVANN_ID: abort(403)
 
@@ -106,7 +106,7 @@ def merge(v, id1, id2):
 
 
 @app.get('/admin/merge_all/')
-@admin_level_required(3)
+@admin_level_required(PERMS['MERGE_USERS'])
 def merge_all(v, id):
 	if v.id != AEVANN_ID: abort(403)
 

From 4aef026594c81d560b592e6575b5252aae08ad96 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:37:18 -0700
Subject: [PATCH 20/81] add and remove admin permissions

---
 files/helpers/const.py | 3 +++
 files/routes/admin.py  | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index cefd6a5e5..a91983c84 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -148,6 +148,9 @@ PERMS = { # Minimum admin_level to perform action.
 	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
 	'VIEW_ACTIVE_USERS': 2,
 	'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
 }
 
 FEATURES = {
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 668bda938..74dc8f458 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -156,13 +156,13 @@ def merge_all(v, id):
 
 
 @app.post("/@/make_admin")
-@admin_level_required(3)
+@admin_level_required(PERMS['ADMIN_ADD'])
 def make_admin(v, username):
 	if SITE == 'rdrama.net': abort(403)
 
 	user = get_user(username)
 
-	user.admin_level = 2
+	user.admin_level = PERMS['ADMIN_ADD_PERM_LEVEL']
 	g.db.add(user)
 
 	ma = ModAction(
@@ -176,7 +176,7 @@ def make_admin(v, username):
 
 
 @app.post("/@/remove_admin")
-@admin_level_required(3)
+@admin_level_required(PERMS['ADMIN_REMOVE'])
 def remove_admin(v, username):
 	user = get_user(username)
 	user.admin_level = 0

From 65c75ba5daacfe4b58cf58ebc630791c4f8d8154 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:47:42 -0700
Subject: [PATCH 21/81] club permissions

---
 files/helpers/const.py | 2 ++
 files/routes/admin.py  | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index a91983c84..df197845a 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -133,6 +133,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'USER_BAN': 2,
 	'USER_SHADOWBAN': 2,
 	'USER_AGENDAPOSTER': 2,
+	'USER_CLUB_ALLOW_BAN': 2,
 	'POST_TO_CHANGELOG': 1,
 	'BYPASS_PIN_LIMIT': 3,
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
@@ -240,6 +241,7 @@ GIFT_NOTIF_ID = 5
 if SITE == 'rdrama.net':
 	FEATURES['PRONOUNS'] = True
 	FEATURES['HOUSES'] = True
+	PERMS['ADMIN_ADD_PERM_LEVEL'] = 0 # extra check here to disallow adding admins on site
 
 	SIDEBAR_THREAD = 37696
 	BANNER_THREAD = 37697
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 74dc8f458..2ccdee9d0 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -299,7 +299,7 @@ def revert_actions(v, username):
 
 @app.post("/@/club_allow")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_CLUB_ALLOW_BAN'])
 def club_allow(v, username):
 	u = get_user(username, v=v)
 
@@ -323,7 +323,7 @@ def club_allow(v, username):
 
 @app.post("/@/club_ban")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_CLUB_ALLOW_BAN'])
 def club_ban(v, username):
 	u = get_user(username, v=v)
 

From a3b9d71e706b17741af5fd204c13253ffe110b93 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 20:50:02 -0700
Subject: [PATCH 22/81] user badge permissions

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index df197845a..9d4e1524e 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -130,6 +130,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'POST_COMMENT_MODERATION': 2,
 	'GLOBAL_HOLE_MODERATION': 3,
 	'POST_EDITING': 3,
+	'USER_BADGES': 2,
 	'USER_BAN': 2,
 	'USER_SHADOWBAN': 2,
 	'USER_AGENDAPOSTER': 2,
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 2ccdee9d0..ae72346c4 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -516,7 +516,7 @@ def under_attack(v):
 		return {"error": "Failed to enable under attack mode."}, 400
 
 @app.get("/admin/badge_grant")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_BADGES'])
 def badge_grant_get(v):
 	if not FEATURES['BADGES']:
 		abort(404)
@@ -527,7 +527,7 @@ def badge_grant_get(v):
 
 @app.post("/admin/badge_grant")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_BADGES'])
 def badge_grant_post(v):
 	if not FEATURES['BADGES']:
 		abort(404)
@@ -577,7 +577,7 @@ def badge_grant_post(v):
 
 
 @app.get("/admin/badge_remove")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_BADGES'])
 def badge_remove_get(v):
 	if not FEATURES['BADGES']:
 		abort(404)
@@ -589,7 +589,7 @@ def badge_remove_get(v):
 
 @app.post("/admin/badge_remove")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(2)
+@admin_level_required(PERMS['USER_BADGES'])
 def badge_remove_post(v):
 	if not FEATURES['BADGES']:
 		abort(404)

From 976f1808c375dd61d28a0f7630e1b33de01fa3e1 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 21:03:24 -0700
Subject: [PATCH 23/81] templates for admins... we REALLY should do something
 about that gigantic code duplication

---
 files/templates/userpage.html | 36 ++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/files/templates/userpage.html b/files/templates/userpage.html
index 37a621afe..c97a5cb2f 100644
--- a/files/templates/userpage.html
+++ b/files/templates/userpage.html
@@ -218,16 +218,14 @@
 
 						Block
 
-						{% if v.admin_level > 2 %}
-							{% if SITE != 'rdrama.net' %}
+						{% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' and not u.admin_level %}
 								Make admin
-							{% endif %}
-
+						{% endif %}
+						{% if v.admin_level >= PERMS['ADMIN_REMOVE'] and u.admin_level %}
 							Remove admin
 
-							{% if u.admin_level > 1 %}
-								Revert admin actions
-							{% endif %}
+						{% if u.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %}
+							Revert admin actions
 						{% endif %}
 						
 
@@ -340,7 +338,7 @@
 								
 						

 						

-
+					{% if v and v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}
 						
@@ -349,7 +347,7 @@

 
 						Disable Chud Theme
-
+					{% endif %}
 						

 
 						Mute
@@ -358,6 +356,7 @@
 
 
 						

+					{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
 						
 							
 							
@@ -369,6 +368,8 @@
 							
 							
 						
+ {% endif %} + {% if v and v.admin_level >= PERMS['USER_CLUB_ALLOW_BAN'] %}

 						{% if FEATURES['COUNTRY_CLUB'] -%}
 						
@@ -376,6 +377,7 @@
 						{%- endif %}
 
 						{% endif %}
+					{% endif %}
 					

 					

User ID: {{u.id}}

@@ -591,16 +593,16 @@ Block - {% if v.admin_level > 2 %} - {% if SITE != 'rdrama.net' %} - Make admin - {% endif %} + {% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' and not u.admin_level %} + Make admin + {% endif %} + {% if v.admin_level >= PERMS['ADMIN_REMOVE'] and u.admin_level %} Remove admin + {% endif %} - {% if u.admin_level > 1 %} - Revert admin actions - {% endif %} + {% if u.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %} + Revert admin actions {% endif %}
@@ -637,7 +639,7 @@ {% if v.admin_level > 1 %} - {% if FEATURES['COUNTRY_CLUB'] -%} + {% if FEATURES['COUNTRY_CLUB'] and v.admin_level >= PERMS['USER_CLUB_ALLOW_BAN'] -%} {%- endif %} From 44bf01151f7da193fd4f2d9c85554ddbe9e9c209 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 21:03:40 -0700 Subject: [PATCH 24/81] apparently this thing likes to commit without committing half of it ok --- files/helpers/const.py | 1 + files/routes/admin.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 9d4e1524e..6b073b502 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -153,6 +153,7 @@ 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, } FEATURES = { diff --git a/files/routes/admin.py b/files/routes/admin.py index ae72346c4..cac8c6179 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -249,7 +249,7 @@ def distribute(v, option_id): @app.post("/@/revert_actions") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(3) +@admin_level_required(PERMS['ADMIN_ACTIONS_REVERT']) def revert_actions(v, username): user = get_user(username) From 9bb7b3758f5a41b5ae0a6732a45d6a8f43278400 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 21:19:11 -0700 Subject: [PATCH 25/81] distinguish stuff --- files/helpers/const.py | 1 + files/routes/admin.py | 4 ++-- files/templates/comments.html | 2 +- files/templates/post_actions.html | 2 +- files/templates/post_admin_actions_mobile.html | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 6b073b502..64cddcfa3 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -128,6 +128,7 @@ PERMS = { # Minimum admin_level to perform action. 'USER_FOLLOWS_VISIBLE': 0, 'USER_VOTERS_VISIBLE': 0, 'POST_COMMENT_MODERATION': 2, + 'POST_COMMENT_DISTINGUISH': 1, 'GLOBAL_HOLE_MODERATION': 3, 'POST_EDITING': 3, 'USER_BADGES': 2, diff --git a/files/routes/admin.py b/files/routes/admin.py index cac8c6179..42c7bead9 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1176,7 +1176,7 @@ def approve_post(post_id, v): @app.post("/distinguish/") -@admin_level_required(1) +@admin_level_required(PERMS['POST_COMMENT_DISTINGUISH']) def distinguish_post(post_id, v): post = get_post(post_id) @@ -1357,7 +1357,7 @@ def approve_comment(c_id, v): @app.post("/distinguish_comment/") -@admin_level_required(1) +@admin_level_required(PERMS['POST_COMMENT_DISTINGUISH']) def admin_distinguish_comment(c_id, v): diff --git a/files/templates/comments.html b/files/templates/comments.html index 18618c3a4..fefc030e2 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -432,7 +432,7 @@

 						

@@ -646,9 +647,8 @@
 
 						

- + {% if v.admin_level >= PERMS['USER_TITLE_CHANGE'] %}
-
@@ -664,7 +664,7 @@
- + {% endif %}

 						


From 047013f92b5ff5840e8a0636766b4bb7e70c9aeb Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 22:48:55 -0700
Subject: [PATCH 38/81] patron perm and also move them around

---
 files/helpers/const.py | 3 ++-
 files/routes/static.py | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 750ee0e23..9c4167d04 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -158,10 +158,11 @@ PERMS = { # Minimum admin_level to perform action.
 	'VIEW_ALTS': 2,
 	'VIEW_PROFILE_VIEWS': 2,
 	'VIEW_SORTED_ADMIN_LIST': 3,
-	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
 	'VIEW_ACTIVE_USERS': 2,
 	'VIEW_ALL_USERS': 2,
 	'VIEW_ALT_VOTES': 2,
+	'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes
+	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
 	'MERGE_USERS': 3, # note: extra check for Aevann
 	'ADMIN_ADD': 3, # note: explicitly disabled on rDrama
 	'ADMIN_REMOVE': 3,
diff --git a/files/routes/static.py b/files/routes/static.py
index 97c286f19..bc5b1d4d3 100644
--- a/files/routes/static.py
+++ b/files/routes/static.py
@@ -107,7 +107,7 @@ def daily_chart(v):
 
 @app.get("/patrons")
 @app.get("/paypigs")
-@admin_level_required(3)
+@admin_level_required(PERMS['VIEW_PATRONS'])
 def patrons(v):
 	if AEVANN_ID and v.id not in (AEVANN_ID, CARP_ID, SNAKES_ID): abort(404)
 

From f2f954e0ddf5eed96449d2f4e44d4155232ab5a8 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 22:50:42 -0700
Subject: [PATCH 39/81] add note about marseybux printing disabled on rDrama

---
 files/helpers/const.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 9c4167d04..9b9ceb8aa 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -162,7 +162,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'VIEW_ALL_USERS': 2,
 	'VIEW_ALT_VOTES': 2,
 	'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes
-	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3,
+	'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,

From 53a5343a55080016632ba0d85e444245a10e84a6 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 22:54:48 -0700
Subject: [PATCH 40/81] use ban permission for muting and also add a user home
 permission (wonder if should be the same as mop perm)

---
 files/helpers/const.py | 1 +
 files/routes/admin.py  | 2 +-
 files/routes/chat.py   | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 9b9ceb8aa..d29b4e925 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -169,6 +169,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'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_SIDEBARS_BANNERS_BADGES': 3,
 	'SITE_SETTINGS_SNAPPY_QUOTES': 3,
diff --git a/files/routes/admin.py b/files/routes/admin.py
index cc7123122..642394a71 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -418,7 +418,7 @@ def reported_comments(v):
 						standalone=True)
 
 @app.get("/admin")
-@admin_level_required(2)
+@admin_level_required(PERMS['ADMIN_HOME_VISIBLE'])
 def admin_home(v):
 	under_attack = False
 
diff --git a/files/routes/chat.py b/files/routes/chat.py
index 9b2085366..56a53b4d6 100644
--- a/files/routes/chat.py
+++ b/files/routes/chat.py
@@ -97,7 +97,7 @@ def speak(data, v):
 
 	total += 1
 
-	if v.admin_level > 1:
+	if v.admin_level >= PERMS['USER_BAN']:
 		text = text.lower()
 		for i in mute_regex.finditer(text):
 			username = i.group(1).lower()

From 6401f9e9c27b0af5e0bde03b0b38a26c3d6232f9 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 22:56:19 -0700
Subject: [PATCH 41/81] shadowban log

---
 files/routes/static.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/files/routes/static.py b/files/routes/static.py
index bc5b1d4d3..a5dd02036 100644
--- a/files/routes/static.py
+++ b/files/routes/static.py
@@ -140,7 +140,7 @@ def log(v):
 
 	kind = request.values.get("kind")
 
-	if v and v.admin_level > 1: types = ACTIONTYPES
+	if v and v.admin_level >= PERMS['USER_SHADOWBAN']: types = ACTIONTYPES
 	else: types = ACTIONTYPES2
 
 	if kind and kind not in types:

From 6911101e290eadbf9a1cd80f5967f719912ec683 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 22:59:27 -0700
Subject: [PATCH 42/81] post bet distributions

---
 files/classes/submission.py | 2 +-
 files/helpers/const.py      | 1 +
 files/routes/admin.py       | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/classes/submission.py b/files/classes/submission.py
index fb7c81a52..1e0816c4e 100644
--- a/files/classes/submission.py
+++ b/files/classes/submission.py
@@ -377,7 +377,7 @@ class Submission(Base):
 				if o.exclusive == 3:
 					body += " - WINNER!"
 				
-				if not winner and v and v.admin_level > 2:
+				if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']:
 					body += f''''''
 				body += ""
 			else:
diff --git a/files/helpers/const.py b/files/helpers/const.py
index d29b4e925..548f96a90 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -141,6 +141,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'POST_TO_CHANGELOG': 1,
 	'POST_TO_POLL_THREAD': 2,
 	'POST_BETS': 3,
+	'POST_BETS_DISTRIBUTE': 3, # probably should be the same as POST_BETS but w/e
 	'BYPASS_PIN_LIMIT': 3,
 	'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
 	'VIEW_PENDING_SUBMITTED_HATS': 3,
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 642394a71..385476cfc 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -193,7 +193,7 @@ def remove_admin(v, username):
 
 @app.post("/distribute/")
 @limiter.limit("1/second;30/minute;200/hour;1000/day")
-@admin_level_required(3)
+@admin_level_required(PERMS['POST_BETS_DISTRIBUTE'])
 def distribute(v, option_id):
 	autojanny = get_account(AUTOJANNY_ID)
 	if autojanny.coins == 0: return {"error": "@AutoJanny has 0 coins"}, 400

From 4fdccc331a2be8d3680a60f4b1021634e8610469 Mon Sep 17 00:00:00 2001
From: justcool393 
Date: Wed, 5 Oct 2022 23:02:27 -0700
Subject: [PATCH 43/81] view last active in template

---
 files/helpers/const.py        | 1 +
 files/templates/userpage.html | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/files/helpers/const.py b/files/helpers/const.py
index 548f96a90..db5d856d7 100644
--- a/files/helpers/const.py
+++ b/files/helpers/const.py
@@ -162,6 +162,7 @@ PERMS = { # Minimum admin_level to perform action.
 	'VIEW_ACTIVE_USERS': 2,
 	'VIEW_ALL_USERS': 2,
 	'VIEW_ALT_VOTES': 2,
+	'VIEW_LAST_ACTIVE': 2,
 	'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes
 	'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, # note: explicitly disabled on rDrama
 	'MERGE_USERS': 3, # note: extra check for Aevann
diff --git a/files/templates/userpage.html b/files/templates/userpage.html
index 51a817f1f..48d9f6e44 100644
--- a/files/templates/userpage.html
+++ b/files/templates/userpage.html
@@ -151,7 +151,7 @@
 
 					joined {{u.created_date}}
 
-					{% if v and v.admin_level >= 2 -%}
+					{% if v and v.admin_level >= PERMS['VIEW_LAST_ACTIVE'] -%}
 						last active {{u.last_active_date}}
 					{%- endif %}
 				
@@ -515,7 +515,7 @@
 
 					
joined {{u.created_date}} - {% if v and v.admin_level >= 2 -%} + {% if v and v.admin_level >= PERMS['VIEW_LAST_ACTIVE'] -%}
last active {{u.last_active_date}} {%- endif %} From 22af7f3bfcfeb27801d318b2754b5ca29753b1f8 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:18:08 -0700 Subject: [PATCH 44/81] admin home page modifications --- files/templates/admin/admin_home.html | 71 ++++++++++++++++----------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 7b0098db1..340e44ab4 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -10,19 +10,21 @@

 

Admin Tools

-{% if v.admin_level > 2 and (SITE_NAME == 'rDrama' or SIDEBAR_THREAD or BANNER_THREAD or BADGE_THREAD or SNAPPY_THREAD) %} +{% if (v.admin_level >= PERMS['SITE_SETTINGS_SIDEBARS_BANNERS_BADGES'] or v.admin_level >= PERMS['SITE_SETTINGS_SNAPPY_QUOTES']) and (SITE_NAME == 'rDrama' or SIDEBAR_THREAD or BANNER_THREAD or BADGE_THREAD or SNAPPY_THREAD) %}

Add Stuff

    - {% if SIDEBAR_THREAD %} -
  • Add Sidebar Images
  • + {% if v.admin_level >= PERMS['SITE_SETTINGS_SIDEBARS_BANNERS_BADGES'] %} + {% if SIDEBAR_THREAD %} +
  • Add Sidebar Images
  • + {% endif %} + {% if BANNER_THREAD %} +
  • Add Banners
  • + {% endif %} + {% if BADGE_THREAD %} +
  • Add Badges
  • + {% endif %} {% endif %} - {% if BANNER_THREAD %} -
  • Add Banners
  • - {% endif %} - {% if BADGE_THREAD %} -
  • Add Badges
  • - {% endif %} - {% if SNAPPY_THREAD %} + {% if SNAPPY_THREAD and v.admin_level >= PERMS['SITE_SETTINGS_SNAPPY_QUOTES'] %}
  • Add Snappy Quotes
  • {% endif %} {% if SITE_NAME == 'rDrama' %} @@ -35,16 +37,22 @@

    Content

    Users

    Safety

    @@ -65,7 +75,7 @@ {% if FEATURES['BADGES'] or FEATURES['AWARDS'] -%}

    Grant

      - {% if FEATURES['BADGES'] -%} + {% if FEATURES['BADGES'] and v.admin_level >= PERMS['USER_BADGES'] -%}
    • Grant Badges
    • Remove Badges
    • {%- endif %} @@ -89,11 +99,15 @@

      Configuration

      -{% if v.admin_level > 2 %} +{% if v.admin_level >= PERMS['SITE_SETTINGS'] %}
      
       	
      @@ -119,15 +133,16 @@
      - -
      - - -
      + {% if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK'] %} +
      + + +
      + {% endif %}
      - {% if SITE_NAME == 'PCM' %} + {% if SITE_NAME == 'PCM' and v.admin_level >= PERMS['PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES'] %} {% endif %} {% endif %} From 8d51980dca0731f2fafe2e5bcba627a4c2890a21 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:21:04 -0700 Subject: [PATCH 45/81] rename cache purge things to include prefix --- files/helpers/const.py | 4 ++-- files/routes/admin.py | 4 ++-- files/templates/admin/admin_home.html | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index db5d856d7..ba4f6dac8 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -176,8 +176,8 @@ PERMS = { # Minimum admin_level to perform action. 'SITE_SETTINGS_SIDEBARS_BANNERS_BADGES': 3, 'SITE_SETTINGS_SNAPPY_QUOTES': 3, 'SITE_SETTINGS_UNDER_ATTACK': 3, - 'CACHE_PURGE_CDN': 3, - 'CACHE_DUMP_INTERNAL': 2, + 'SITE_CACHE_PURGE_CDN': 3, + 'SITE_CACHE_DUMP_INTERNAL': 2, 'DOMAINS_BAN': 3, 'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2, 'NOTIFICATIONS_HOLE_CREATION': 2, diff --git a/files/routes/admin.py b/files/routes/admin.py index 385476cfc..346b32ada 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -471,7 +471,7 @@ def change_settings(v, setting): @app.post("/admin/purge_cache") -@admin_level_required(PERMS['CACHE_PURGE_CDN']) +@admin_level_required(PERMS['SITE_CACHE_PURGE_CDN']) def purge_cache(v): online = cache.get(ONLINE_STR) cache.clear() @@ -1386,7 +1386,7 @@ def admin_distinguish_comment(c_id, v): else: return {"message": "Comment undistinguished!"} @app.get("/admin/dump_cache") -@admin_level_required(PERMS['CACHE_DUMP_INTERNAL']) +@admin_level_required(PERMS['SITE_CACHE_DUMP_INTERNAL']) def admin_dump_cache(v): online = cache.get(ONLINE_STR) cache.clear() diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 340e44ab4..ed324624f 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -139,8 +139,9 @@ {% endif %} - - + {% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %} + + {% endif %}
      {% if SITE_NAME == 'PCM' and v.admin_level >= PERMS['PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES'] %} From 039fa606d6ca8b2514c7fe098204cc89287ceaa2 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:22:42 -0700 Subject: [PATCH 46/81] streamer permissions --- files/helpers/const.py | 1 + files/routes/static.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index ba4f6dac8..f2fa1e17d 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -186,6 +186,7 @@ PERMS = { # Minimum admin_level to perform action. 'NOTIFICATIONS_FOR_SPECIFIC_WPD_COMMENTS': 1, 'MESSAGE_BLOCKED_USERS': 1, 'APPS_MODERATE': 3, + 'STREAMERS_MODERATION': 2, } FEATURES = { diff --git a/files/routes/static.py b/files/routes/static.py index a5dd02036..14a55beb6 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -559,7 +559,7 @@ if SITE == 'pcmemes.net': return render_template('live.html', v=v, live=live, offline=offline) @app.post('/live/add') - @admin_level_required(2) + @admin_level_required(PERMS['STREAMERS_MODERATION']) def live_add(v): link = request.values.get('link').strip() @@ -598,7 +598,7 @@ if SITE == 'pcmemes.net': return redirect('/live') @app.post('/live/remove') - @admin_level_required(2) + @admin_level_required(PERMS['STREAMERS_MODERATION']) def live_remove(v): id = request.values.get('id').strip() if not id: abort(400) From 98397e7d3fca4042bd4b402ceb2959e5ecf74c1a Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:27:34 -0700 Subject: [PATCH 47/81] admin home and user last active viewing --- files/templates/header.html | 4 ++-- files/templates/user_listing.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/templates/header.html b/files/templates/header.html index 93589d8fa..ba223062a 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -114,7 +114,7 @@ {% endif %} {% if not err %} - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['ADMIN_HOME_VISIBLE'] %} {% endif %} @@ -159,7 +159,7 @@ {% endif %} - {% if v.admin_level > 1 %} + {% if v.admin_level >= PERMS['ADMIN_HOME_VISIBLE'] %} diff --git a/files/templates/user_listing.html b/files/templates/user_listing.html index c56758741..920aa0997 100644 --- a/files/templates/user_listing.html +++ b/files/templates/user_listing.html @@ -29,7 +29,7 @@
      Joined on
      - {% if v.admin_level >= 2 -%} + {% if v.admin_level >= PERMS['VIEW_LAST_ACTIVE'] -%}
      Last active on
      {%- endif %} From 45f40f32b7eff1c341236bf3b8ccb8a9164465cf Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:33:39 -0700 Subject: [PATCH 48/81] admin user page fix --- files/templates/userpage.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 48d9f6e44..c44fb0153 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -218,12 +218,12 @@ Block - {% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' and not u.admin_level %} - Make admin + {% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' %} + Make admin + {% endif %} + {% if v.admin_level >= PERMS['ADMIN_REMOVE'] %} + Remove admin {% endif %} - {% if v.admin_level >= PERMS['ADMIN_REMOVE'] and u.admin_level %} - Remove admin - {% if u.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %} Revert admin actions {% endif %} @@ -594,12 +594,12 @@ Block - {% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' and not u.admin_level %} - Make admin + {% if v.admin_level >= PERMS['ADMIN_ADD'] and SITE != 'rdrama.net' %} + Make admin {% endif %} - {% if v.admin_level >= PERMS['ADMIN_REMOVE'] and u.admin_level %} - Remove admin + {% if v.admin_level >= PERMS['ADMIN_REMOVE'] %} + Remove admin {% endif %} {% if u.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %} From 6c3b0f13dac11927690afd4878630ad25380ecbe Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:45:27 -0700 Subject: [PATCH 49/81] search and stuff --- files/routes/search.py | 2 +- files/templates/post_actions.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/search.py b/files/routes/search.py index 8f543a8aa..24257bbaf 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -222,7 +222,7 @@ def searchcomments(v): comments = apply_time_filter(t, comments, Comment) - if v.admin_level < 2: + if v.admin_level < PERMS['POST_COMMENT_MODERATION']: private = [x[0] for x in g.db.query(Submission.id).filter(Submission.private == True).all()] comments = comments.filter(Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private)) diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 4aed29a6b..7db0111d4 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -55,7 +55,7 @@ Unpin from /h/{{p.sub}} {% endif %} - {% if FEATURES['COUNTRY_CLUB'] and (v.admin_level > 1 or v.id == p.author_id) %} + {% if FEATURES['COUNTRY_CLUB'] and (v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or v.id == p.author_id) %} Mark club Unmark club {% endif %} @@ -98,7 +98,7 @@ Unmark +18 {% endif %} - {% if v.admin_level > 1 and v.id != p.author_id %} + {% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %} Ban user Unban user {% endif %} From d04e5a188c686beec2867b4a1aa4c9557aeca719 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:46:37 -0700 Subject: [PATCH 50/81] streamer moderation templateend --- files/templates/live.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/templates/live.html b/files/templates/live.html index 7d0fd19a8..0688078d9 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -54,7 +54,7 @@ {{name}} {{title}} {{viewers}} watching - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['STREAMERS_MODERATION'] %}
      @@ -80,7 +80,7 @@ {{name}} {{actual}} ago {{views}} views - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['STREAMERS_MODERATION'] %} @@ -96,7 +96,7 @@ - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['STREAMERS_MODERATION'] %} From 9b8a3f21ab54b09b7bb1a5972be938115b9d9c23 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 23:56:37 -0700 Subject: [PATCH 51/81] templateend hats, marseys, apps, notifications, etc --- files/templates/comments.html | 6 +++--- files/templates/notifications.html | 2 +- files/templates/post_admin_actions_mobile.html | 2 +- files/templates/submission.html | 2 +- files/templates/submit_hats.html | 2 +- files/templates/submit_marseys.html | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/templates/comments.html b/files/templates/comments.html index fefc030e2..95c3d504a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -490,7 +490,7 @@ {% endif %} -{% if v.admin_level > 1 and c.oauth_app %} +{% if v.admin_level >= PERMS['APPS_MODERATE'] and c.oauth_app %} API App {% endif %}
    @@ -567,7 +567,7 @@ {% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %} - {% if (v and v.admin_level >= 2) and (c.sentto == 2) and not c.author.is_muted %} + {% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == 2) and not c.author.is_muted %} Mute {% endif %} @@ -720,7 +720,7 @@ Approve {% endif %} - {% if c.oauth_app %} + {% if c.oauth_app and v.admin_level >= PERMS['APPS_MODERATE'] %} API App {% endif %}
diff --git a/files/templates/notifications.html b/files/templates/notifications.html index 6c53ebd0e..5093935ae 100644 --- a/files/templates/notifications.html +++ b/files/templates/notifications.html @@ -37,7 +37,7 @@ {% endif %} - {% if v.admin_level >= 2 %} + {% if v.admin_level >= PERMS['VIEW_MODMAIL'] %} - {% if v and request.path.startswith('/@') and v.admin_level < 2 %} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM1'] %}
  • {% if voted==1 %} @@ -366,7 +366,7 @@
    • - {% if v and request.path.startswith('/@') and v.admin_level < 2%} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM2'] %} {% if voted==1 %} {% endif %} @@ -383,7 +383,7 @@ {{score}} - {% if v and request.path.startswith('/@') and v.admin_level < 2 %} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM3'] %} {% if voted==-1 %}
    • {% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index f2440b297..8183aa277 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -53,7 +53,7 @@ {% block subNav %} -{% set mod = (v and v.admin_level > 1) %} +{% set mod = (v and v.admin_level >= PERMS['UNKNOWN_ADMIN_LEVEL2_PERM4']) %} {% if not request.path.startswith('/h/') %}
      diff --git a/files/templates/submission.html b/files/templates/submission.html index b7ba3f682..e08f4ba33 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -902,7 +902,7 @@ - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level >= PERMS['ADMIN_HOME_VISIBLE'] %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 6cdb61256..57b452171 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -48,7 +48,7 @@ {% if not postembed %}
      - {% if v and request.path.startswith('/@') and v.admin_level < 2 %} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM5'] %}
      {{score}} @@ -245,7 +245,7 @@ {% endif %} {% if not postembed %} - {% if v and request.path.startswith('/@') and v.admin_level < 2 %} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM6'] %}
    • From ad7f3b7363bfbae072959fa3930e30ab20ea6f39 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 6 Oct 2022 00:34:57 -0700 Subject: [PATCH 56/81] > to >= --- files/routes/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 346b32ada..33af4d068 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1213,7 +1213,7 @@ def sticky_post(post_id, v): if not post.stickied: pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count() if pins >= PIN_LIMIT: - if v.admin_level > PERMS['BYPASS_PIN_LIMIT']: + if v.admin_level >= PERMS['BYPASS_PIN_LIMIT']: post.stickied = v.username post.stickied_utc = int(time.time()) + 3600 else: return {"error": f"Can't exceed {PIN_LIMIT} pinned posts limit!"}, 403 From 6e33531be306514ed3caf8ab4ba1ab2f49fcb85a Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 6 Oct 2022 00:38:33 -0700 Subject: [PATCH 57/81] remove a _FOR_ --- files/helpers/alerts.py | 2 +- files/helpers/const.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index ba5aac9b6..ffff2e041 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -95,7 +95,7 @@ def NOTIFY_USERS(text, v): notify_users.add(user.id) if SITE_NAME == "WPD" and 'daisy' in text.lower(): - admin_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_FOR_SPECIFIC_WPD_COMMENTS']).all()] + admin_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_SPECIFIC_WPD_COMMENTS']).all()] notify_users.update(admin_ids) return notify_users - bots diff --git a/files/helpers/const.py b/files/helpers/const.py index 9394a2a30..b08529e42 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -183,7 +183,7 @@ PERMS = { # Minimum admin_level to perform action. 'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, 'NOTIFICATIONS_MODMAIL': 3, - 'NOTIFICATIONS_FOR_SPECIFIC_WPD_COMMENTS': 1, + 'NOTIFICATIONS_SPECIFIC_WPD_COMMENTS': 1, 'MESSAGE_BLOCKED_USERS': 1, 'APPS_MODERATE': 3, 'STREAMERS_MODERATION': 2, From 02d0e2043ed15c73547545261e208193cf0badbd Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 6 Oct 2022 00:40:36 -0700 Subject: [PATCH 58/81] rename APPS_MODERATE to APPS_MODERATION --- files/helpers/const.py | 2 +- files/routes/oauth.py | 14 +++++++------- files/templates/admin/admin_home.html | 2 +- files/templates/comments.html | 4 ++-- files/templates/post_admin_actions_mobile.html | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index b08529e42..a7d2d8f00 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -185,7 +185,7 @@ PERMS = { # Minimum admin_level to perform action. 'NOTIFICATIONS_MODMAIL': 3, 'NOTIFICATIONS_SPECIFIC_WPD_COMMENTS': 1, 'MESSAGE_BLOCKED_USERS': 1, - 'APPS_MODERATE': 3, + 'APPS_MODERATION': 3, 'STREAMERS_MODERATION': 2, 'UNKNOWN_ADMIN_LEVEL2_PERM1': 2, 'UNKNOWN_ADMIN_LEVEL2_PERM2': 2, diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 35f46d118..ea736d6cf 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -83,7 +83,7 @@ def request_api_keys(v): new_comment.top_comment_id = new_comment.id - for admin in g.db.query(User).filter(User.admin_level >= PERMS['APPS_MODERATE']).all(): + for admin in g.db.query(User).filter(User.admin_level >= PERMS['APPS_MODERATION']).all(): notif = Notification(comment_id=new_comment.id, user_id=admin.id) g.db.add(notif) @@ -137,7 +137,7 @@ def edit_oauth_app(v, aid): @app.post("/admin/app/approve/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_app_approve(v, aid): app = g.db.get(OauthApp, aid) @@ -173,7 +173,7 @@ def admin_app_approve(v, aid): @app.post("/admin/app/revoke/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_app_revoke(v, aid): app = g.db.get(OauthApp, aid) @@ -198,7 +198,7 @@ def admin_app_revoke(v, aid): @app.post("/admin/app/reject/") @limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_app_reject(v, aid): app = g.db.get(OauthApp, aid) @@ -223,7 +223,7 @@ def admin_app_reject(v, aid): @app.get("/admin/app/") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_app_id(v, aid): aid=aid oauth = g.db.get(OauthApp, aid) @@ -244,7 +244,7 @@ def admin_app_id(v, aid): ) @app.get("/admin/app//comments") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_app_id_comments(v, aid): aid=aid @@ -271,7 +271,7 @@ def admin_app_id_comments(v, aid): @app.get("/admin/apps") -@admin_level_required(PERMS['APPS_MODERATE']) +@admin_level_required(PERMS['APPS_MODERATION']) def admin_apps_list(v): apps = g.db.query(OauthApp).order_by(OauthApp.id.desc()).all() diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index ed324624f..2bc0050e3 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -102,7 +102,7 @@ {% if v.admin_level >= PERMS['HOLE_CREATE'] %}
    • Create {{ HOLE_NAME | capitalize }}
    • {% endif %} - {% if v.admin_level >= PERMS['APPS_MODERATE'] %} + {% if v.admin_level >= PERMS['APPS_MODERATION'] %}
    • Apps
    • {% endif %}
    diff --git a/files/templates/comments.html b/files/templates/comments.html index bcd30e88e..b03bcaa13 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -490,7 +490,7 @@ {% endif %} -{% if v.admin_level >= PERMS['APPS_MODERATE'] and c.oauth_app %} +{% if v.admin_level >= PERMS['APPS_MODERATION'] and c.oauth_app %} API App {% endif %} @@ -721,7 +721,7 @@ {% endif %} {% endif %} - {% if c.oauth_app and v.admin_level >= PERMS['APPS_MODERATE'] %} + {% if c.oauth_app and v.admin_level >= PERMS['APPS_MODERATION'] %} API App {% endif %} diff --git a/files/templates/post_admin_actions_mobile.html b/files/templates/post_admin_actions_mobile.html index 34131ba28..bc937b17a 100644 --- a/files/templates/post_admin_actions_mobile.html +++ b/files/templates/post_admin_actions_mobile.html @@ -34,7 +34,7 @@ {% endif %} - {% if p.oauth_app and v.admin_level >= PERMS['APPS_MODERATE'] %} + {% if p.oauth_app and v.admin_level >= PERMS['APPS_MODERATION'] %} {% endif %} From 8bed8c64e8ae2b0630128f353e1d11e755914b54 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 6 Oct 2022 00:55:54 -0700 Subject: [PATCH 59/81] rearrange and rename a couple of permissions --- files/classes/user.py | 2 +- files/helpers/const.py | 18 +++++++++--------- files/routes/admin.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 59a157d72..01c4c56e9 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -319,7 +319,7 @@ class User(Base): @lazy 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() if not mod: return None return mod.created_utc diff --git a/files/helpers/const.py b/files/helpers/const.py index a7d2d8f00..2fe736942 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -121,7 +121,15 @@ AGENDAPOSTER_MSG_HTML = """

    Hi /') -@admin_level_required(PERMS['MERGE_USERS']) +@admin_level_required(PERMS['USER_MERGE']) def merge(v, id1, id2): if v.id != AEVANN_ID: abort(403) @@ -106,7 +106,7 @@ def merge(v, id1, id2): @app.get('/admin/merge_all/') -@admin_level_required(PERMS['MERGE_USERS']) +@admin_level_required(PERMS['USER_MERGE']) def merge_all(v, id): if v.id != AEVANN_ID: abort(403) From 397cf68abd8f26ec94dbef1cc64aa0ded148ddf5 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 6 Oct 2022 01:14:32 -0700 Subject: [PATCH 60/81] view vote buttons on user page --- files/helpers/const.py | 6 +----- files/templates/comments.html | 6 +++--- files/templates/submission_listing.html | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 2fe736942..e44fa9d57 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -172,6 +172,7 @@ PERMS = { # Minimum admin_level to perform action. 'VIEW_ALT_VOTES': 2, 'VIEW_LAST_ACTIVE': 2, 'VIEW_PATRONS': 3, # note: extra check for Aevann, carp, or snakes + 'VIEW_VOTE_BUTTONS_ON_USER_PAGE': 2, 'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, # note: explicitly disabled on rDrama 'SITE_SETTINGS': 3, 'SITE_SETTINGS_SIDEBARS_BANNERS_BADGES': 3, @@ -187,12 +188,7 @@ PERMS = { # Minimum admin_level to perform action. 'MESSAGE_BLOCKED_USERS': 1, 'APPS_MODERATION': 3, 'STREAMERS_MODERATION': 2, - 'UNKNOWN_ADMIN_LEVEL2_PERM1': 2, - 'UNKNOWN_ADMIN_LEVEL2_PERM2': 2, - 'UNKNOWN_ADMIN_LEVEL2_PERM3': 2, 'UNKNOWN_ADMIN_LEVEL2_PERM4': 2, - 'UNKNOWN_ADMIN_LEVEL2_PERM5': 2, - 'UNKNOWN_ADMIN_LEVEL2_PERM6': 2, } FEATURES = { diff --git a/files/templates/comments.html b/files/templates/comments.html index b03bcaa13..7028d366c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -315,7 +315,7 @@

  • - {% if v and request.path.startswith('/@') and v.admin_level < PERMS['UNKNOWN_ADMIN_LEVEL2_PERM1'] %} + {% if v and request.path.startswith('/@') and v.admin_level < PERMS['VIEW_VOTE_BUTTONS_ON_USER_PAGE'] %}
  • {% if voted==1 %} @@ -366,7 +366,7 @@