Skip to content

Instantly share code, notes, and snippets.

@AceSevenFive
Created May 5, 2018 21:45
Show Gist options
  • Save AceSevenFive/967bdb410396150a135ca038acf736ce to your computer and use it in GitHub Desktop.
Save AceSevenFive/967bdb410396150a135ca038acf736ce to your computer and use it in GitHub Desktop.
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