You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k4ever/k4ever/main/helper.py

15 lines
394 B

from main.models import PluginPermission
def getUserFromAuthblob(authblob, plugin, splitBy="\n"):
""" Return user, if found, for an authblob, else None. """
if authblob == '':
return None
perms = PluginPermission.objects.filter(plugin=plugin, authblob__contains=authblob)
for perm in perms:
print perm
if authblob in perm.authblob.split(splitBy):
return perm.user
return None