only allow jannies to view deleted accounts

master
Aevann 2024-11-14 00:23:20 +02:00
parent 4c8876a561
commit fc8b96773f
2 changed files with 6 additions and 0 deletions

View File

@ -158,6 +158,7 @@ TAGLINES = ()
if SITE_NAME == 'rDrama':
PERMS = { # Minimum admin_level to perform action.
'HOLE_CREATE': 0,
'VIEW_DELETED_ACCOUNTS': 0,
'POST_BETS': 1,
'POST_BETS_DISTRIBUTE': 1,
@ -328,6 +329,7 @@ else:
'POST_IN_H_ANNOUNCEMENTS': 3,
'VIEW_CHATS': 3,
'PUBLISH_OTHERS_POSTS': 3,
'VIEW_DELETED_ACCOUNTS': 3,
'VIEW_CHAT_LIST': 4,
'INFINITE_CURRENCY': 4,

View File

@ -158,6 +158,10 @@ def auth_required(f):
stop(401, "You need to login to perform this action!")
if v.is_permabanned and request.method == "POST" and request.path not in {'/contact','/reply','/logout'} and not request.path.startswith('/delete/'):
stop(403, "You can't perform this action while permabanned!")
if request.path.startswith('/@DELETED-') and v.admin_level < PERMS['VIEW_DELETED_ACCOUNTS']:
stop(403, "Account is deleted.")
return make_response(f(*args, v=v, **kwargs))
wrapper.__name__ = f.__name__
return wrapper