Browse Source

Added helper for Authblob

master
Sebastian Lohff 11 years ago
parent
commit
c0e9f81bf0
  1. 14
      k4ever/main/helper.py

14
k4ever/main/helper.py

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
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
Loading…
Cancel
Save