From f803c90da1873a1bec99635868e347b66b8987b3 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 2 Sep 2015 16:55:56 -0400 Subject: [PATCH] End-user UI for SP Portal Update the root page to include the list of SAML2 Service Providers in a dynamic layout with a filter which can search on SP name and description. Hide providers that the admin does not want visible. https://fedorahosted.org/ipsilon/ticket/148 Signed-off-by: Rob Crittenden Reviewed-by: Patrick Uiterwijk --- ipsilon/providers/common.py | 3 + ipsilon/providers/saml2idp.py | 3 + ipsilon/root.py | 8 +- templates/index.html | 141 ++++++++++++++++++++++++++++++++-- templates/master-admin.html | 1 + templates/master.html | 1 + 6 files changed, 148 insertions(+), 9 deletions(-) diff --git a/ipsilon/providers/common.py b/ipsilon/providers/common.py index c4d6658..caa2be5 100644 --- a/ipsilon/providers/common.py +++ b/ipsilon/providers/common.py @@ -61,6 +61,9 @@ class ProviderBase(ConfigHelper, PluginObject): def on_disable(self): self._root.del_subtree(self.name) + def get_providers(self): + return [] + class ProviderPageBase(Page): diff --git a/ipsilon/providers/saml2idp.py b/ipsilon/providers/saml2idp.py index 4c2639f..2e6f346 100644 --- a/ipsilon/providers/saml2idp.py +++ b/ipsilon/providers/saml2idp.py @@ -285,6 +285,9 @@ Provides SAML 2.0 authentication infrastructure. """ logger.addHandler(lh) logger.setLevel(logging.DEBUG) + def get_providers(self): + return self.admin.providers + @property def allow_self_registration(self): return self.get_config_value('allow self registration') diff --git a/ipsilon/root.py b/ipsilon/root.py index daef90f..d701616 100644 --- a/ipsilon/root.py +++ b/ipsilon/root.py @@ -51,5 +51,11 @@ class Root(Page): def root(self): self.debug(self.html_heads) + providers = [] + for plugin in self._site['provider_config'].enabled: + # pylint: disable=no-member,protected-access + obj = self.admin.providers._get_plugin_obj(plugin) + providers.extend(obj.get_providers()) + providers = sorted(providers, key=lambda provider: provider.name) return self._template('index.html', title='Ipsilon', - heads=self.html_heads) + providers=providers, heads=self.html_heads) diff --git a/templates/index.html b/templates/index.html index 7d368cb..cf54fc4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,9 +1,56 @@ -{% extends "master.html" %} -{% block main %} + + + + Ipsilon + + + + + + + + +
+

{% if user.name %}

Welcome {{ user.fullname }}!

+

Select a Service Provider + {% if user.is_admin %} + or go to the + Administration Console + {% endif %} + .

{% endif %}
@@ -18,13 +65,91 @@
{% if user.name %} -

- {% if user.is_admin %} - Administration | +

+ +
+ +
+
+
+ + + +
+
+
+ +
+
+
+ +
+ {% for p in providers %} + {% if p.visible == '1' %} + {% endif %} - Log Out -

+ {% endfor %} + +
+ + +
+ {% endif %}
-{% endblock %} \ No newline at end of file + + + + + + + + + + + diff --git a/templates/master-admin.html b/templates/master-admin.html index 8987df9..f7cd163 100644 --- a/templates/master-admin.html +++ b/templates/master-admin.html @@ -6,6 +6,7 @@ + diff --git a/templates/master.html b/templates/master.html index cf1275a..49103d0 100644 --- a/templates/master.html +++ b/templates/master.html @@ -8,6 +8,7 @@ + {%- if heads %} {%- for group, value in heads.items() %} {%- for head in value %} -- 2.20.1