X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=ipsilon%2Fproviders%2Fsaml2%2Fadmin.py;h=811af9f906c394aff7c46c21c4c3ae22f318c1a7;hb=826e6339441546f596320f3d73304ab5f7c10de6;hp=931d096af8000e542d1653bc8089123f7a8e25ab;hpb=158c4cdefc0bd5b8dabe38685c1bebccc24d656b;p=cascardo%2Fipsilon.git diff --git a/ipsilon/providers/saml2/admin.py b/ipsilon/providers/saml2/admin.py index 931d096..811af9f 100644 --- a/ipsilon/providers/saml2/admin.py +++ b/ipsilon/providers/saml2/admin.py @@ -1,19 +1,4 @@ -# Copyright (C) 2014 Simo Sorce -# -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# Copyright (C) 2014 Ipsilon project Contributors, for license see COPYING import cherrypy from ipsilon.util import config as pconfig @@ -28,6 +13,7 @@ from ipsilon.providers.saml2.provider import ServiceProviderCreator from ipsilon.providers.saml2.provider import InvalidProviderId from copy import deepcopy import requests +import logging class NewSPAdminPage(AdminPage): @@ -156,6 +142,9 @@ class SPAdminPage(AdminPage): value = kwargs[name] if isinstance(option, pconfig.List): value = [x.strip() for x in value.split('\n')] + # for normal lists we want unordered comparison + if set(value) == set(option.get_value()): + continue elif isinstance(option, pconfig.Condition): value = True else: @@ -167,9 +156,9 @@ class SPAdminPage(AdminPage): aname = '%s_%s' % (name, a) if aname in kwargs: value.append(a) - elif type(option) is pconfig.ComplexList: + elif isinstance(option, pconfig.MappingList): current = deepcopy(option.get_value()) - value = get_complex_list_value(name, + value = get_mapping_list_value(name, current, **kwargs) # if current value is None do nothing @@ -177,9 +166,9 @@ class SPAdminPage(AdminPage): if option.get_value() is None: continue # else pass and let it continue as None - elif type(option) is pconfig.MappingList: + elif isinstance(option, pconfig.ComplexList): current = deepcopy(option.get_value()) - value = get_mapping_list_value(name, + value = get_complex_list_value(name, current, **kwargs) # if current value is None do nothing @@ -191,11 +180,8 @@ class SPAdminPage(AdminPage): continue if value != option.get_value(): - if (type(option) is pconfig.List and - set(value) == set(option.get_value())): - continue cherrypy.log.error("Storing %s = %s" % - (name, value)) + (name, value), severity=logging.DEBUG) new_db_values[name] = value if len(new_db_values) != 0: @@ -206,8 +192,9 @@ class SPAdminPage(AdminPage): if (not self.user.is_admin and self.user.name != self.sp.owner): raise UnauthorizedUser("Unauthorized to set owner") - elif key in ['Owner', 'Default NameID', 'Allowed NameIDs', - 'Attribute Mapping', 'Allowed Attributes']: + elif key in ['User Owner', 'Default NameID', + 'Allowed NameIDs', 'Attribute Mapping', + 'Allowed Attributes']: if not self.user.is_admin: raise UnauthorizedUser( "Unauthorized to set %s" % key