2017-10-14 19:36:13 +02:00
|
|
|
from django.dispatch import receiver
|
|
|
|
from django_cas_ng.signals import cas_user_authenticated, cas_user_logout
|
2024-10-23 11:06:57 +02:00
|
|
|
|
2017-10-14 19:36:13 +02:00
|
|
|
from . import rhosts
|
|
|
|
|
|
|
|
|
|
|
|
@receiver(cas_user_authenticated)
|
|
|
|
def onCasLogin(sender, user, **kwargs):
|
2024-10-23 11:06:57 +02:00
|
|
|
"""Called upon login of a user through CAS"""
|
2017-10-14 19:36:13 +02:00
|
|
|
rhosts.evalRhostsPrivileges(user)
|
|
|
|
|
|
|
|
|
|
|
|
@receiver(cas_user_logout)
|
|
|
|
def onCasLogout(sender, user, **kwargs):
|
2024-10-23 11:06:57 +02:00
|
|
|
"""Strip the user from their privileges — in case something goes wrong
|
|
|
|
during the next authentication"""
|
2017-10-14 19:36:13 +02:00
|
|
|
rhosts.logout(user)
|