eed3653d22
Whenever a user logs in through CAS, their username is looked up in the .rhosts file provided through settings. If it is found, the user is granted staff status and BOcal group (cf fixture). The rights are re-evaluated at each login and at each access to /admin/login. Close #2.
13 lines
367 B
Python
13 lines
367 B
Python
from django_cas_ng.backends import CASBackend
|
|
from .models import CasUser
|
|
from . import rhosts
|
|
|
|
|
|
class BOcalCASBackend(CASBackend):
|
|
# Partly from Robin Champenois's "ExperiENS". Thanks!
|
|
def clean_username(self, username):
|
|
return username.lower().strip()
|
|
|
|
def configure_user(self, user):
|
|
casUser = CasUser(user=user)
|
|
casUser.save()
|