on_cas_collect_histories = dispatch.Signal(providing_args=["for_email"])
on_cas_login = dispatch.Signal(providing_args=["request"])
+
+cas_collect_custom_attributes = dispatch.Signal(providing_args=['user'])
username = etree.SubElement(auth_success, CAS + 'user')
username.text = user.username
- if settings.CAS_CUSTOM_ATTRIBUTES_CALLBACK:
- callback = get_callable(settings.CAS_CUSTOM_ATTRIBUTES_CALLBACK)
- attrs = callback(user)
- if len(attrs) > 0:
- formatter = get_callable(settings.CAS_CUSTOM_ATTRIBUTES_FORMATER)
- formatter(auth_success, attrs)
+ attrs = {}
+ for receiver, response in signals.cas_collect_custom_attributes.send(user):
+ if response:
+ attrs.update(response)
+
+ if attrs:
+ formatter = get_callable(settings.CAS_CUSTOM_ATTRIBUTES_FORMATER)
+ formatter(auth_success, attrs)
if pgt:
pgtElement = etree.SubElement(auth_success, CAS + 'proxyGrantingTicket')