From b0a07efe414fa82ff343ffb7e7b91a5f68c9f089 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Mon, 4 Jul 2016 17:40:31 +0200 Subject: [PATCH] Add a display field to Identity Providers --- README.rst | 3 + cas_server/admin.py | 3 +- cas_server/forms.py | 2 +- cas_server/locale/en/LC_MESSAGES/django.mo | Bin 6105 -> 6105 bytes cas_server/locale/en/LC_MESSAGES/django.po | 80 ++++++++++-------- cas_server/locale/fr/LC_MESSAGES/django.mo | Bin 8347 -> 8496 bytes cas_server/locale/fr/LC_MESSAGES/django.po | 80 ++++++++++-------- .../0008_federatediendityprovider_display.py | 20 +++++ cas_server/models.py | 5 ++ 9 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 cas_server/migrations/0008_federatediendityprovider_display.py diff --git a/README.rst b/README.rst index ebcaaa0..da4840d 100644 --- a/README.rst +++ b/README.rst @@ -354,6 +354,9 @@ An identity provider comes with 5 fields: * `CAS protocol version`: the version of the CAS protocol to use to contact the identity provider. The default is version 3. * `Verbose name`: the name used on the login page to display the identity provider. +* `Display`: a boolean controlling the display of the identity provider on the login page. + Beware that this do not disable the identity provider, it just hide it on the login page. + User will always be able to log in using this provider by fetching `/federate/provider_suffix`. In federation mode, ``django-cas-server`` build user's username as follow: diff --git a/cas_server/admin.py b/cas_server/admin.py index f2baf81..2ea243b 100644 --- a/cas_server/admin.py +++ b/cas_server/admin.py @@ -93,7 +93,8 @@ class ServicePatternAdmin(admin.ModelAdmin): class FederatedIendityProviderAdmin(admin.ModelAdmin): - fields = ('pos', 'suffix', 'server_url', 'cas_protocol_version', 'verbose_name') + fields = ('pos', 'suffix', 'server_url', 'cas_protocol_version', 'verbose_name', 'display') + list_display = ('verbose_name', 'suffix', 'display') admin.site.register(User, UserAdmin) diff --git a/cas_server/forms.py b/cas_server/forms.py index bf7a0e2..5284fac 100644 --- a/cas_server/forms.py +++ b/cas_server/forms.py @@ -34,7 +34,7 @@ class FederateSelect(forms.Form): allowing the user to choose a identity provider. """ provider = forms.ModelChoiceField( - queryset=models.FederatedIendityProvider.objects.all().order_by( + queryset=models.FederatedIendityProvider.objects.filter(display=True).order_by( "pos", "verbose_name", "suffix" diff --git a/cas_server/locale/en/LC_MESSAGES/django.mo b/cas_server/locale/en/LC_MESSAGES/django.mo index ac062279497e09c2d1d8f373a76b2b01c87a1880..8a9dda44316919636e9d665a5eb9f42f8da97fcf 100644 GIT binary patch delta 22 dcmcbqe^Y;h4KI_i*0~=zH6XP)jklN!09EP+fdBvi diff --git a/cas_server/locale/en/LC_MESSAGES/django.po b/cas_server/locale/en/LC_MESSAGES/django.po index 0ab0f93..6d4de34 100644 --- a/cas_server/locale/en/LC_MESSAGES/django.po +++ b/cas_server/locale/en/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: cas_server\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-04 17:15+0200\n" -"PO-Revision-Date: 2016-07-04 17:15+0200\n" +"POT-Creation-Date: 2016-07-04 17:36+0200\n" +"PO-Revision-Date: 2016-07-04 17:39+0200\n" "Last-Translator: Valentin Samir \n" "Language-Team: django \n" "Language: en\n" @@ -104,48 +104,56 @@ msgstr "" msgid "Name for this identity provider displayed on the login page" msgstr "" -#: models.py:70 models.py:312 +#: models.py:70 models.py:317 msgid "position" msgstr "position" -#: models.py:159 +#: models.py:80 +msgid "display" +msgstr "" + +#: models.py:81 +msgid "Display the provider on the login page" +msgstr "" + +#: models.py:164 msgid "User" msgstr "" -#: models.py:160 +#: models.py:165 msgid "Users" msgstr "" -#: models.py:229 +#: models.py:234 #, python-format msgid "Error during service logout %s" msgstr "Error during service logout %s" -#: models.py:307 +#: models.py:312 msgid "Service pattern" msgstr "Service pattern" -#: models.py:308 +#: models.py:313 msgid "Services patterns" msgstr "" -#: models.py:313 +#: models.py:318 msgid "service patterns are sorted using the position attribute" msgstr "" -#: models.py:320 models.py:444 +#: models.py:325 models.py:449 msgid "name" msgstr "name" -#: models.py:321 +#: models.py:326 msgid "A name for the service" msgstr "A name for the service" -#: models.py:326 models.py:473 models.py:492 +#: models.py:331 models.py:478 models.py:497 msgid "pattern" msgstr "pattern" -#: models.py:328 +#: models.py:333 msgid "" "A regular expression matching services. Will usually looks like '^https://" "some\\.server\\.com/path/.*$'.As it is a regular expression, special " @@ -155,73 +163,73 @@ msgstr "" "some\\.server\\.com/path/.*$'.As it is a regular expression, special " "character must be escaped with a '\\'." -#: models.py:337 +#: models.py:342 msgid "user field" msgstr "" -#: models.py:338 +#: models.py:343 msgid "Name of the attribut to transmit as username, empty = login" msgstr "Name of the attribut to transmit as username, empty = login" -#: models.py:342 +#: models.py:347 msgid "restrict username" msgstr "" -#: models.py:343 +#: models.py:348 msgid "Limit username allowed to connect to the list provided bellow" msgstr "Limit username allowed to connect to the list provided bellow" -#: models.py:347 +#: models.py:352 msgid "proxy" msgstr "proxy" -#: models.py:348 +#: models.py:353 msgid "Proxy tickets can be delivered to the service" msgstr "Proxy tickets can be delivered to the service" -#: models.py:352 +#: models.py:357 msgid "proxy callback" msgstr "proxy callback" -#: models.py:353 +#: models.py:358 msgid "can be used as a proxy callback to deliver PGT" msgstr "can be used as a proxy callback to deliver PGT" -#: models.py:357 +#: models.py:362 msgid "single log out" msgstr "" -#: models.py:358 +#: models.py:363 msgid "Enable SLO for the service" msgstr "Enable SLO for the service" -#: models.py:365 +#: models.py:370 msgid "single log out callback" msgstr "" -#: models.py:366 +#: models.py:371 msgid "" "URL where the SLO request will be POST. empty = service url\n" "This is usefull for non HTTP proxied services." msgstr "" -#: models.py:428 +#: models.py:433 msgid "username" msgstr "" -#: models.py:429 +#: models.py:434 msgid "username allowed to connect to the service" msgstr "username allowed to connect to the service" -#: models.py:445 +#: models.py:450 msgid "name of an attribut to send to the service, use * for all attributes" msgstr "name of an attribut to send to the service, use * for all attributes" -#: models.py:450 models.py:498 +#: models.py:455 models.py:503 msgid "replace" msgstr "replace" -#: models.py:451 +#: models.py:456 msgid "" "name under which the attribut will be showto the service. empty = default " "name of the attribut" @@ -229,27 +237,27 @@ msgstr "" "name under which the attribut will be showto the service. empty = default " "name of the attribut" -#: models.py:468 models.py:487 +#: models.py:473 models.py:492 msgid "attribut" msgstr "attribut" -#: models.py:469 +#: models.py:474 msgid "Name of the attribut which must verify pattern" msgstr "Name of the attribut which must verify pattern" -#: models.py:474 +#: models.py:479 msgid "a regular expression" msgstr "a regular expression" -#: models.py:488 +#: models.py:493 msgid "Name of the attribut for which the value must be replace" msgstr "Name of the attribut for which the value must be replace" -#: models.py:493 +#: models.py:498 msgid "An regular expression maching whats need to be replaced" msgstr "An regular expression maching whats need to be replaced" -#: models.py:499 +#: models.py:504 msgid "replace expression, groups are capture by \\1, \\2 …" msgstr "replace expression, groups are capture by \\1, \\2 …" diff --git a/cas_server/locale/fr/LC_MESSAGES/django.mo b/cas_server/locale/fr/LC_MESSAGES/django.mo index 362bc4caf94487b373335bdc130cf87f19738c44..cd54e7aeb82557f437c101613f1562769afc3463 100644 GIT binary patch delta 1705 zcmYk+eP~T_9LMpmyGNUcJ#mcTGTS`u$#92_jbRfae@uC(ac8?)yK9r8xPOpBqHg|> zP!pw?aoZBL2$4Lr;t&4thZ2${{NX8if6hJ0ulv2P^E>CB-|u(6zwf!HYkQYQUS}nq zG+G0ZM+ALlO?WwxFIri$**Pr76F7)Raa)SnSRBIZn3QT3z#F(2KYNxAH=9qt9XVwe zFb8{Zl3B#=a-f0UU@rc^EX+=epD)Bh`qeldgUF2*!Av}h8n73u@jgz*gmg33YWbLi zGrfKpE}|d6O6IpN@5E&+;lg_yiOvYKVk|&SxB-=+PSk>r<7m8yT1Y>x#)mi;$1uoF zT!l(zA8KJYu@+xp4)a^ysQ3!YQ3C`}PjnEKvQt=s-AJ}=5H;aTRHi=>O|Tbd;sGQH z)`MEmEj&KV>^An%U&pF1VsbY5zr?|n?08BWdF&zj?WiZ%GRAB@cH>g~hVI^xfAza? z9QNZ>e1=o-3(mqECtfo($j3JERfSzR5qll-uMTC1n-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HJK1EJ>D@Ktl!PAJuC zuu4MNpltt*TvoJ3I79kC-JceG8SQOcuO&k}sm1;ss<4W%k|-qjfw59T1*8t)&QMXR zh+tc6cBm<4Dl*g_e\n" "Language-Team: django \n" "Language: fr\n" @@ -111,48 +111,56 @@ msgstr "Nom du fournisseur" msgid "Name for this identity provider displayed on the login page" msgstr "Nom affiché pour ce fournisseur d'identité sur la page de connexion" -#: models.py:70 models.py:312 +#: models.py:70 models.py:317 msgid "position" msgstr "position" -#: models.py:159 +#: models.py:80 +msgid "display" +msgstr "afficher" + +#: models.py:81 +msgid "Display the provider on the login page" +msgstr "Afficher le fournisseur d'identité sur la page de connexion" + +#: models.py:164 msgid "User" msgstr "Utilisateur" -#: models.py:160 +#: models.py:165 msgid "Users" msgstr "Utilisateurs" -#: models.py:229 +#: models.py:234 #, python-format msgid "Error during service logout %s" msgstr "Une erreur est survenue durant la déconnexion du service %s" -#: models.py:307 +#: models.py:312 msgid "Service pattern" msgstr "Motif de service" -#: models.py:308 +#: models.py:313 msgid "Services patterns" msgstr "Motifs de services" -#: models.py:313 +#: models.py:318 msgid "service patterns are sorted using the position attribute" msgstr "Les motifs de service sont trié selon l'attribut position" -#: models.py:320 models.py:444 +#: models.py:325 models.py:449 msgid "name" msgstr "nom" -#: models.py:321 +#: models.py:326 msgid "A name for the service" msgstr "Un nom pour le service" -#: models.py:326 models.py:473 models.py:492 +#: models.py:331 models.py:478 models.py:497 msgid "pattern" msgstr "motif" -#: models.py:328 +#: models.py:333 msgid "" "A regular expression matching services. Will usually looks like '^https://" "some\\.server\\.com/path/.*$'.As it is a regular expression, special " @@ -163,55 +171,55 @@ msgstr "" "expression rationnelle, les caractères spéciaux doivent être échappés avec " "un '\\'." -#: models.py:337 +#: models.py:342 msgid "user field" msgstr "champ utilisateur" -#: models.py:338 +#: models.py:343 msgid "Name of the attribut to transmit as username, empty = login" msgstr "" "Nom de l'attribut devant être transmis comme nom d'utilisateur au service. " "vide = nom de connection" -#: models.py:342 +#: models.py:347 msgid "restrict username" msgstr "limiter les noms d'utilisateurs" -#: models.py:343 +#: models.py:348 msgid "Limit username allowed to connect to the list provided bellow" msgstr "" "Limiter les noms d'utilisateurs autorisé à se connecter à la liste fournie " "ci-dessous" -#: models.py:347 +#: models.py:352 msgid "proxy" msgstr "proxy" -#: models.py:348 +#: models.py:353 msgid "Proxy tickets can be delivered to the service" msgstr "des proxy tickets peuvent être délivrés au service" -#: models.py:352 +#: models.py:357 msgid "proxy callback" msgstr "" -#: models.py:353 +#: models.py:358 msgid "can be used as a proxy callback to deliver PGT" msgstr "peut être utilisé comme un callback pour recevoir un PGT" -#: models.py:357 +#: models.py:362 msgid "single log out" msgstr "" -#: models.py:358 +#: models.py:363 msgid "Enable SLO for the service" msgstr "Active le SLO pour le service" -#: models.py:365 +#: models.py:370 msgid "single log out callback" msgstr "" -#: models.py:366 +#: models.py:371 msgid "" "URL where the SLO request will be POST. empty = service url\n" "This is usefull for non HTTP proxied services." @@ -220,51 +228,51 @@ msgstr "" "service\n" "Ceci n'est utilise que pour des services non HTTP proxifiés" -#: models.py:428 +#: models.py:433 msgid "username" msgstr "nom d'utilisateur" -#: models.py:429 +#: models.py:434 msgid "username allowed to connect to the service" msgstr "noms d'utilisateurs autorisé à se connecter au service" -#: models.py:445 +#: models.py:450 msgid "name of an attribut to send to the service, use * for all attributes" msgstr "" "nom d'un attribut a envoyer au service, utiliser * pour tous les attributs" -#: models.py:450 models.py:498 +#: models.py:455 models.py:503 msgid "replace" msgstr "remplacement" -#: models.py:451 +#: models.py:456 msgid "" "name under which the attribut will be showto the service. empty = default " "name of the attribut" msgstr "" "nom sous lequel l'attribut sera rendu visible au service. vide = inchangé" -#: models.py:468 models.py:487 +#: models.py:473 models.py:492 msgid "attribut" msgstr "attribut" -#: models.py:469 +#: models.py:474 msgid "Name of the attribut which must verify pattern" msgstr "Nom de l'attribut devant vérifier un motif" -#: models.py:474 +#: models.py:479 msgid "a regular expression" msgstr "une expression régulière" -#: models.py:488 +#: models.py:493 msgid "Name of the attribut for which the value must be replace" msgstr "nom de l'attribue pour lequel la valeur doit être remplacé" -#: models.py:493 +#: models.py:498 msgid "An regular expression maching whats need to be replaced" msgstr "une expression régulière reconnaissant ce qui doit être remplacé" -#: models.py:499 +#: models.py:504 msgid "replace expression, groups are capture by \\1, \\2 …" msgstr "expression de remplacement, les groupe sont capturé par \\1, \\2" diff --git a/cas_server/migrations/0008_federatediendityprovider_display.py b/cas_server/migrations/0008_federatediendityprovider_display.py new file mode 100644 index 0000000..ec1a3b2 --- /dev/null +++ b/cas_server/migrations/0008_federatediendityprovider_display.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-04 15:33 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cas_server', '0007_auto_20160704_1510'), + ] + + operations = [ + migrations.AddField( + model_name='federatediendityprovider', + name='display', + field=models.BooleanField(default=True, help_text='Display the provider on the login page', verbose_name='display'), + ), + ] diff --git a/cas_server/models.py b/cas_server/models.py index 971cce5..675260c 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -75,6 +75,11 @@ class FederatedIendityProvider(models.Model): ) ) ) + display = models.BooleanField( + default=True, + verbose_name=_(u"display"), + help_text=_("Display the provider on the login page") + ) def __str__(self): return self.verbose_name