Add a display field to Identity Providers

This commit is contained in:
Valentin Samir 2016-07-04 17:40:31 +02:00
parent aa433d3c58
commit b0a07efe41
9 changed files with 119 additions and 74 deletions

View file

@ -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. * `CAS protocol version`: the version of the CAS protocol to use to contact the identity provider.
The default is version 3. The default is version 3.
* `Verbose name`: the name used on the login page to display the identity provider. * `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: In federation mode, ``django-cas-server`` build user's username as follow:

View file

@ -93,7 +93,8 @@ class ServicePatternAdmin(admin.ModelAdmin):
class FederatedIendityProviderAdmin(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) admin.site.register(User, UserAdmin)

View file

@ -34,7 +34,7 @@ class FederateSelect(forms.Form):
allowing the user to choose a identity provider. allowing the user to choose a identity provider.
""" """
provider = forms.ModelChoiceField( provider = forms.ModelChoiceField(
queryset=models.FederatedIendityProvider.objects.all().order_by( queryset=models.FederatedIendityProvider.objects.filter(display=True).order_by(
"pos", "pos",
"verbose_name", "verbose_name",
"suffix" "suffix"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: cas_server\n" "Project-Id-Version: cas_server\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-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:15+0200\n" "PO-Revision-Date: 2016-07-04 17:39+0200\n"
"Last-Translator: Valentin Samir <valentin.samir@crans.org>\n" "Last-Translator: Valentin Samir <valentin.samir@crans.org>\n"
"Language-Team: django <LL@li.org>\n" "Language-Team: django <LL@li.org>\n"
"Language: en\n" "Language: en\n"
@ -104,48 +104,56 @@ msgstr ""
msgid "Name for this identity provider displayed on the login page" msgid "Name for this identity provider displayed on the login page"
msgstr "" msgstr ""
#: models.py:70 models.py:312 #: models.py:70 models.py:317
msgid "position" msgid "position"
msgstr "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" msgid "User"
msgstr "" msgstr ""
#: models.py:160 #: models.py:165
msgid "Users" msgid "Users"
msgstr "" msgstr ""
#: models.py:229 #: models.py:234
#, python-format #, python-format
msgid "Error during service logout %s" msgid "Error during service logout %s"
msgstr "Error during service logout %s" msgstr "Error during service logout %s"
#: models.py:307 #: models.py:312
msgid "Service pattern" msgid "Service pattern"
msgstr "Service pattern" msgstr "Service pattern"
#: models.py:308 #: models.py:313
msgid "Services patterns" msgid "Services patterns"
msgstr "" msgstr ""
#: models.py:313 #: models.py:318
msgid "service patterns are sorted using the position attribute" msgid "service patterns are sorted using the position attribute"
msgstr "" msgstr ""
#: models.py:320 models.py:444 #: models.py:325 models.py:449
msgid "name" msgid "name"
msgstr "name" msgstr "name"
#: models.py:321 #: models.py:326
msgid "A name for the service" msgid "A name for the service"
msgstr "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" msgid "pattern"
msgstr "pattern" msgstr "pattern"
#: models.py:328 #: models.py:333
msgid "" msgid ""
"A regular expression matching services. Will usually looks like '^https://" "A regular expression matching services. Will usually looks like '^https://"
"some\\.server\\.com/path/.*$'.As it is a regular expression, special " "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 " "some\\.server\\.com/path/.*$'.As it is a regular expression, special "
"character must be escaped with a '\\'." "character must be escaped with a '\\'."
#: models.py:337 #: models.py:342
msgid "user field" msgid "user field"
msgstr "" msgstr ""
#: models.py:338 #: models.py:343
msgid "Name of the attribut to transmit as username, empty = login" msgid "Name of the attribut to transmit as username, empty = login"
msgstr "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" msgid "restrict username"
msgstr "" msgstr ""
#: models.py:343 #: models.py:348
msgid "Limit username allowed to connect to the list provided bellow" msgid "Limit username allowed to connect to the list provided bellow"
msgstr "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" msgid "proxy"
msgstr "proxy" msgstr "proxy"
#: models.py:348 #: models.py:353
msgid "Proxy tickets can be delivered to the service" msgid "Proxy tickets can be delivered to the service"
msgstr "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" msgid "proxy callback"
msgstr "proxy callback" msgstr "proxy callback"
#: models.py:353 #: models.py:358
msgid "can be used as a proxy callback to deliver PGT" msgid "can be used as a proxy callback to deliver PGT"
msgstr "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" msgid "single log out"
msgstr "" msgstr ""
#: models.py:358 #: models.py:363
msgid "Enable SLO for the service" msgid "Enable SLO for the service"
msgstr "Enable SLO for the service" msgstr "Enable SLO for the service"
#: models.py:365 #: models.py:370
msgid "single log out callback" msgid "single log out callback"
msgstr "" msgstr ""
#: models.py:366 #: models.py:371
msgid "" msgid ""
"URL where the SLO request will be POST. empty = service url\n" "URL where the SLO request will be POST. empty = service url\n"
"This is usefull for non HTTP proxied services." "This is usefull for non HTTP proxied services."
msgstr "" msgstr ""
#: models.py:428 #: models.py:433
msgid "username" msgid "username"
msgstr "" msgstr ""
#: models.py:429 #: models.py:434
msgid "username allowed to connect to the service" msgid "username allowed to connect to the service"
msgstr "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" 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" 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" msgid "replace"
msgstr "replace" msgstr "replace"
#: models.py:451 #: models.py:456
msgid "" msgid ""
"name under which the attribut will be showto the service. empty = default " "name under which the attribut will be showto the service. empty = default "
"name of the attribut" "name of the attribut"
@ -229,27 +237,27 @@ msgstr ""
"name under which the attribut will be showto the service. empty = default " "name under which the attribut will be showto the service. empty = default "
"name of the attribut" "name of the attribut"
#: models.py:468 models.py:487 #: models.py:473 models.py:492
msgid "attribut" msgid "attribut"
msgstr "attribut" msgstr "attribut"
#: models.py:469 #: models.py:474
msgid "Name of the attribut which must verify pattern" msgid "Name of the attribut which must verify pattern"
msgstr "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" msgid "a regular expression"
msgstr "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" msgid "Name of the attribut for which the value must be replace"
msgstr "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" msgid "An regular expression maching whats need to be replaced"
msgstr "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 …" msgid "replace expression, groups are capture by \\1, \\2 …"
msgstr "replace expression, groups are capture by \\1, \\2 …" msgstr "replace expression, groups are capture by \\1, \\2 …"

View file

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: cas_server\n" "Project-Id-Version: cas_server\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-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:21+0200\n" "PO-Revision-Date: 2016-07-04 17:37+0200\n"
"Last-Translator: Valentin Samir <valentin.samir@crans.org>\n" "Last-Translator: Valentin Samir <valentin.samir@crans.org>\n"
"Language-Team: django <LL@li.org>\n" "Language-Team: django <LL@li.org>\n"
"Language: fr\n" "Language: fr\n"
@ -111,48 +111,56 @@ msgstr "Nom du fournisseur"
msgid "Name for this identity provider displayed on the login page" msgid "Name for this identity provider displayed on the login page"
msgstr "Nom affiché pour ce fournisseur d'identité sur la page de connexion" 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" msgid "position"
msgstr "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" msgid "User"
msgstr "Utilisateur" msgstr "Utilisateur"
#: models.py:160 #: models.py:165
msgid "Users" msgid "Users"
msgstr "Utilisateurs" msgstr "Utilisateurs"
#: models.py:229 #: models.py:234
#, python-format #, python-format
msgid "Error during service logout %s" msgid "Error during service logout %s"
msgstr "Une erreur est survenue durant la déconnexion du service %s" msgstr "Une erreur est survenue durant la déconnexion du service %s"
#: models.py:307 #: models.py:312
msgid "Service pattern" msgid "Service pattern"
msgstr "Motif de service" msgstr "Motif de service"
#: models.py:308 #: models.py:313
msgid "Services patterns" msgid "Services patterns"
msgstr "Motifs de services" msgstr "Motifs de services"
#: models.py:313 #: models.py:318
msgid "service patterns are sorted using the position attribute" msgid "service patterns are sorted using the position attribute"
msgstr "Les motifs de service sont trié selon l'attribut position" 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" msgid "name"
msgstr "nom" msgstr "nom"
#: models.py:321 #: models.py:326
msgid "A name for the service" msgid "A name for the service"
msgstr "Un nom pour le 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" msgid "pattern"
msgstr "motif" msgstr "motif"
#: models.py:328 #: models.py:333
msgid "" msgid ""
"A regular expression matching services. Will usually looks like '^https://" "A regular expression matching services. Will usually looks like '^https://"
"some\\.server\\.com/path/.*$'.As it is a regular expression, special " "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 " "expression rationnelle, les caractères spéciaux doivent être échappés avec "
"un '\\'." "un '\\'."
#: models.py:337 #: models.py:342
msgid "user field" msgid "user field"
msgstr "champ utilisateur" msgstr "champ utilisateur"
#: models.py:338 #: models.py:343
msgid "Name of the attribut to transmit as username, empty = login" msgid "Name of the attribut to transmit as username, empty = login"
msgstr "" msgstr ""
"Nom de l'attribut devant être transmis comme nom d'utilisateur au service. " "Nom de l'attribut devant être transmis comme nom d'utilisateur au service. "
"vide = nom de connection" "vide = nom de connection"
#: models.py:342 #: models.py:347
msgid "restrict username" msgid "restrict username"
msgstr "limiter les noms d'utilisateurs" msgstr "limiter les noms d'utilisateurs"
#: models.py:343 #: models.py:348
msgid "Limit username allowed to connect to the list provided bellow" msgid "Limit username allowed to connect to the list provided bellow"
msgstr "" msgstr ""
"Limiter les noms d'utilisateurs autorisé à se connecter à la liste fournie " "Limiter les noms d'utilisateurs autorisé à se connecter à la liste fournie "
"ci-dessous" "ci-dessous"
#: models.py:347 #: models.py:352
msgid "proxy" msgid "proxy"
msgstr "proxy" msgstr "proxy"
#: models.py:348 #: models.py:353
msgid "Proxy tickets can be delivered to the service" msgid "Proxy tickets can be delivered to the service"
msgstr "des proxy tickets peuvent être délivrés au service" msgstr "des proxy tickets peuvent être délivrés au service"
#: models.py:352 #: models.py:357
msgid "proxy callback" msgid "proxy callback"
msgstr "" msgstr ""
#: models.py:353 #: models.py:358
msgid "can be used as a proxy callback to deliver PGT" msgid "can be used as a proxy callback to deliver PGT"
msgstr "peut être utilisé comme un callback pour recevoir un PGT" msgstr "peut être utilisé comme un callback pour recevoir un PGT"
#: models.py:357 #: models.py:362
msgid "single log out" msgid "single log out"
msgstr "" msgstr ""
#: models.py:358 #: models.py:363
msgid "Enable SLO for the service" msgid "Enable SLO for the service"
msgstr "Active le SLO pour le service" msgstr "Active le SLO pour le service"
#: models.py:365 #: models.py:370
msgid "single log out callback" msgid "single log out callback"
msgstr "" msgstr ""
#: models.py:366 #: models.py:371
msgid "" msgid ""
"URL where the SLO request will be POST. empty = service url\n" "URL where the SLO request will be POST. empty = service url\n"
"This is usefull for non HTTP proxied services." "This is usefull for non HTTP proxied services."
@ -220,51 +228,51 @@ msgstr ""
"service\n" "service\n"
"Ceci n'est utilise que pour des services non HTTP proxifiés" "Ceci n'est utilise que pour des services non HTTP proxifiés"
#: models.py:428 #: models.py:433
msgid "username" msgid "username"
msgstr "nom d'utilisateur" msgstr "nom d'utilisateur"
#: models.py:429 #: models.py:434
msgid "username allowed to connect to the service" msgid "username allowed to connect to the service"
msgstr "noms d'utilisateurs autorisé à se connecter au 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" msgid "name of an attribut to send to the service, use * for all attributes"
msgstr "" msgstr ""
"nom d'un attribut a envoyer au service, utiliser * pour tous les attributs" "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" msgid "replace"
msgstr "remplacement" msgstr "remplacement"
#: models.py:451 #: models.py:456
msgid "" msgid ""
"name under which the attribut will be showto the service. empty = default " "name under which the attribut will be showto the service. empty = default "
"name of the attribut" "name of the attribut"
msgstr "" msgstr ""
"nom sous lequel l'attribut sera rendu visible au service. vide = inchangé" "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" msgid "attribut"
msgstr "attribut" msgstr "attribut"
#: models.py:469 #: models.py:474
msgid "Name of the attribut which must verify pattern" msgid "Name of the attribut which must verify pattern"
msgstr "Nom de l'attribut devant vérifier un motif" msgstr "Nom de l'attribut devant vérifier un motif"
#: models.py:474 #: models.py:479
msgid "a regular expression" msgid "a regular expression"
msgstr "une expression régulière" msgstr "une expression régulière"
#: models.py:488 #: models.py:493
msgid "Name of the attribut for which the value must be replace" msgid "Name of the attribut for which the value must be replace"
msgstr "nom de l'attribue pour lequel la valeur doit être remplacé" 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" msgid "An regular expression maching whats need to be replaced"
msgstr "une expression régulière reconnaissant ce qui doit être remplacé" 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 …" msgid "replace expression, groups are capture by \\1, \\2 …"
msgstr "expression de remplacement, les groupe sont capturé par \\1, \\2" msgstr "expression de remplacement, les groupe sont capturé par \\1, \\2"

View file

@ -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'),
),
]

View file

@ -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): def __str__(self):
return self.verbose_name return self.verbose_name