.BANCHO. Add support for locked accounts

This commit is contained in:
Nyo
2016-09-13 11:39:39 +02:00
parent 48925c58c0
commit 14348a68bb
4 changed files with 33 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
from helpers import passwordHelper
from constants import gameModes
from constants import privileges
from helpers import generalFunctions
from objects import glob
from helpers import logHelper as log
@@ -385,6 +386,19 @@ def isBanned(userID):
else:
return True
def isLocked(userID):
"""
Check if userID is locked
userID -- id of the user
return -- True if not locked, otherwise false.
"""
result = glob.db.fetch("SELECT privileges FROM users WHERE id = %s LIMIT 1", [userID])
if result != None:
return ((result["privileges"] & privileges.USER_PUBLIC > 0) and (result["privileges"] & privileges.USER_NORMAL == 0))
else:
return True
def ban(userID):
"""
Ban userID