Created
May 5, 2018 21:45
-
-
Save AceSevenFive/967bdb410396150a135ca038acf736ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def checkPermissions(user, permrequired): | |
if(permrequired == "777"): | |
if(user in superusers.readlines()): | |
return True | |
else: | |
return False | |
else: | |
with codecs.open("users.txt", "r") as file: | |
if(user in superusers.readlines()): | |
return True | |
else: | |
userperms = [line for line in file.readlines() if user in line] | |
perms = userperms.split("=")[3] | |
if(int(perms, 2) & int(permrequired, 2) >= int(permrequired, 2)): | |
return True | |
else: | |
return False | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment