Fix first CAS connection problem
`user` was not returned by configure_user
This commit is contained in:
parent
7797314c09
commit
865a249002
2 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
|||
from django_cas_ng.backends import CASBackend
|
||||
from .models import CasUser
|
||||
from . import rhosts
|
||||
|
||||
|
||||
class BOcalCASBackend(CASBackend):
|
||||
|
@ -11,3 +10,4 @@ class BOcalCASBackend(CASBackend):
|
|||
def configure_user(self, user):
|
||||
casUser = CasUser(user=user)
|
||||
casUser.save()
|
||||
return user
|
||||
|
|
|
@ -71,9 +71,11 @@ def grantBOcalPrivileges(user):
|
|||
|
||||
|
||||
def requireCasUser(fct):
|
||||
def hasCas(user):
|
||||
return CasUser.objects.filter(user=user).count() > 0
|
||||
|
||||
def wrap(user, *args, **kwargs):
|
||||
qs = CasUser.objects.filter(user=user)
|
||||
if not qs.count() > 0:
|
||||
if not hasCas(user):
|
||||
return
|
||||
return fct(user, *args, **kwargs)
|
||||
return wrap
|
||||
|
|
Loading…
Reference in a new issue