summaryrefslogtreecommitdiffstats
path: root/django/sp_sso/saml/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/sp_sso/saml/utils.py')
-rw-r--r--django/sp_sso/saml/utils.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/django/sp_sso/saml/utils.py b/django/sp_sso/saml/utils.py
index 5ff3502..5e5768b 100644
--- a/django/sp_sso/saml/utils.py
+++ b/django/sp_sso/saml/utils.py
@@ -29,9 +29,17 @@ supann_host_role_value = '{SUPANN}R10' # 'Responsable de mission'
def render_message(request, message):
+ """Renders a simple message to a base template"""
return render(request, 'simple_message.html', {'message': message})
def generate_eppn(lastname):
+ """
+ Used when no eduPersonPrincipalName attribute is fetched from the
+ identity provider during the single sign-on process.
+
+ Returns a randomly generated EPPN value in the form of a valid Campus
+ Condorcet email address.
+ """
return "%s-%06d@campus-condorcet.fr"%(lastname, randint(0,pow(10,6)))
@@ -59,19 +67,22 @@ def ldap_init():
def ldap_get_etablissements():
-# Used to fill the choices in hote_etablissemnt form ChoiceField:
+ """Used to fill the choices in hote_etablissemnt form ChoiceField."""
return ldap_get_attribute_from_subtree_nodes(
structures_base, '(objectClass=supannOrg)', 'ou')
def ldap_get_unites():
-# Used to fill the choices in hote_unite form ChoiceField:
+ """Used to fill the choices in hote_unite form ChoiceField."""
return ldap_get_attribute_from_subtree_nodes(
structures_base, '(supannTypeEntite=*)', 'ou')
def ldap_get_affectations():
-# Used to fill the choices in s_entite_affectation_principale form ChoiceField:
+ """
+ Used to fill the choices in s_entite_affectation_principale form
+ ChoiceField.
+ """
return ldap_get_attribute_from_subtree_nodes(
structures_base, '(objectClass=supannEntite)', 'supannCodeEntite')