diff --git a/files/classes/user.py b/files/classes/user.py index 3d3bdbcf5..62d6e5897 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -273,7 +273,7 @@ class User(Base): @property @lazy def allowed_in_chat(self): - if self.admin_level >= PERMS['SITE_BYPASS_CHAT_TRUESCORE_REQUIREMENT']: + if self.admin_level >= PERMS['BYPASS_CHAT_TRUESCORE_REQUIREMENT']: return True if self.truescore >= TRUESCORE_CC_CHAT_MINIMUM: return True diff --git a/files/helpers/actions.py b/files/helpers/actions.py index c6b0faf74..b9997a147 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -376,7 +376,7 @@ def tempban_for_spam(v): def execute_antispam_post_check(title, v, url): - if v.admin_level >= PERMS['SITE_BYPASS_ANTISPAM_CHECKS']: + if v.admin_level >= PERMS['BYPASS_ANTISPAM_CHECKS']: return True now = int(time.time()) @@ -419,7 +419,7 @@ def execute_antispam_post_check(title, v, url): return True def execute_antispam_duplicate_comment_check(v, body_html): - if v.admin_level >= PERMS['SITE_BYPASS_ANTISPAM_CHECKS']: + if v.admin_level >= PERMS['BYPASS_ANTISPAM_CHECKS']: return if v.id in ANTISPAM_BYPASS_IDS: return @@ -440,7 +440,7 @@ def execute_antispam_duplicate_comment_check(v, body_html): abort(403, "Too much spam!") def execute_antispam_comment_check(body, v): - if v.admin_level >= PERMS['SITE_BYPASS_ANTISPAM_CHECKS']: + if v.admin_level >= PERMS['BYPASS_ANTISPAM_CHECKS']: return if v.id in ANTISPAM_BYPASS_IDS: return @@ -500,7 +500,7 @@ def execute_under_siege(v, target, body, kind): if kind != 'post': return if not get_setting("under_siege"): return - if v.admin_level >= PERMS['SITE_BYPASS_UNDER_SIEGE_MODE']: return + if v.admin_level >= PERMS['BYPASS_UNDER_SIEGE_MODE']: return if kind in {'message', 'report'} and SITE == 'rdrama.net': threshold = 86400 diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index a95899cec..2418ea0ba 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -353,12 +353,12 @@ PERMS = { # Minimum admin_level to perform action. 'POST_COMMENT_DISTINGUISH': 1, 'POST_IN_GHOST_THREADS': 1, 'VIEW_RESTRICTED_HOLES': 1, - 'SITE_BYPASS_READ_ONLY_MODE': 1, - 'SITE_BYPASS_UNDER_SIEGE_MODE': 1, - 'SITE_BYPASS_CHAT_TRUESCORE_REQUIREMENT': 1, - 'SITE_BYPASS_ANTISPAM_CHECKS': 1, - 'SITE_BYPASS_PROFILE_VIEWS': 1, - 'SITE_WARN_ON_INVALID_AUTH': 1, + 'BYPASS_SITE_READ_ONLY_MODE': 1, + 'BYPASS_UNDER_SIEGE_MODE': 1, + 'BYPASS_CHAT_TRUESCORE_REQUIREMENT': 1, + 'BYPASS_ANTISPAM_CHECKS': 1, + 'BYPASS_PROFILE_VIEWS': 1, + 'WARN_ON_FAILED_LOGIN': 1, 'NOTIFICATIONS_REDDIT': 1, 'NOTIFICATIONS_SPECIFIC_WPD_COMMENTS': 1, 'MESSAGE_BLOCKED_USERS': 1, diff --git a/files/routes/login.py b/files/routes/login.py index efee57e22..9e676ed3c 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -105,7 +105,7 @@ def login_post(v): return redirect('/') def log_failed_admin_login_attempt(account, type): - if not account or account.admin_level < PERMS['SITE_WARN_ON_INVALID_AUTH']: return + if not account or account.admin_level < PERMS['WARN_ON_FAILED_LOGIN']: return ip = get_CF() print(f"A site admin from {ip} failed to login to account @{account.user_name} (invalid {type})") t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())) diff --git a/files/routes/users.py b/files/routes/users.py index 9892b9031..fd97f33f7 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -950,7 +950,7 @@ def u_username_wall(v, username): is_following = v and u.has_follower(v) - if v and v.id != u.id and v.admin_level < PERMS['SITE_BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): + if v and v.id != u.id and v.admin_level < PERMS['BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): gevent.spawn(_add_profile_view, v.id, u.id) page = get_page() @@ -997,7 +997,7 @@ def u_username_wall_comment(v, username, cid): is_following = v and u.has_follower(v) - if v and v.id != u.id and v.admin_level < PERMS['SITE_BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): + if v and v.id != u.id and v.admin_level < PERMS['BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): gevent.spawn(_add_profile_view, v.id, u.id) if v and request.values.get("read"): @@ -1042,7 +1042,7 @@ def u_username(v, username): abort(403, f"@{u.username}'s userpage is private") return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 - if v and v.id != u.id and v.admin_level < PERMS['SITE_BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): + if v and v.id != u.id and v.admin_level < PERMS['BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): gevent.spawn(_add_profile_view, v.id, u.id) sort = request.values.get("sort", "new") @@ -1109,7 +1109,7 @@ def u_username_comments(username, v): abort(403, f"@{u.username}'s userpage is private") return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 - if v and v.id != u.id and v.admin_level < PERMS['SITE_BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): + if v and v.id != u.id and v.admin_level < PERMS['BYPASS_PROFILE_VIEWS'] and not session.get("GLOBAL"): gevent.spawn(_add_profile_view, v.id, u.id) page = get_page() diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index b6c8dd890..dd6996977 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -100,7 +100,7 @@ def get_logged_in_user(): else: session.pop("lo_user") - if request.method.lower() != "get" and get_setting('read_only_mode') and not (v and v.admin_level >= PERMS['SITE_BYPASS_READ_ONLY_MODE']): + if request.method.lower() != "get" and get_setting('read_only_mode') and not (v and v.admin_level >= PERMS['BYPASS_SITE_READ_ONLY_MODE']): abort(403, "Site is in read-only mode right now. It will be back shortly!") if get_setting('offline_mode') and not (v and v.admin_level >= PERMS['SITE_OFFLINE_MODE']):