diff --git a/creolefuncs/lemonldap.py b/creolefuncs/lemonldap.py index b812c7d..e2e62b5 100644 --- a/creolefuncs/lemonldap.py +++ b/creolefuncs/lemonldap.py @@ -32,6 +32,7 @@ def getSSOFilters(): """ import glob from ConfigParser import ConfigParser + try: filters = { 'uid': "uid", "mail": "mail" } filterDirectory = "/usr/share/sso/app_filters/" @@ -49,14 +50,18 @@ def getSSOFilters(): for key in toClean: if key in filters.keys(): del(filters[key]) - res = "" + res = {} index=0 size=len(filters) + return(filters.items()) + """ for k,v in filters.items(): - res += " \"{0}\": \"{1}\"".format(k,v) + res[k] " \"{0}\": \"{1}\"".format(k,v) index += 1 if index != size: res += ",\n" return(res) + """ except: return "Error Generating Filters" + diff --git a/tmpl/lmConf-1.js b/tmpl/lmConf-1.js index cc77f47..a447560 100644 --- a/tmpl/lmConf-1.js +++ b/tmpl/lmConf-1.js @@ -1,3 +1,4 @@ +%set %%ssoFilters = %%getSSOFilters { "ldapGroupAttributeNameUser": "dn", "cfgAuthorIP": "172.16.0.1", @@ -67,9 +68,18 @@ "exportedVars": { "UA": "HTTP_USER_AGENT", %for att in %%casAttribute - "%%att": "%%att.casLDAPAttribute", + "%%att": "%%att", +%end for +%set %%idx = 0 +%set %%size = %%len(%%ssoFilters) - 1 +%for key,value in %%ssoFilters + %if %%idx == %%size + "%%key": "%%value" + %else + "%%key": "%%value", + %end if + %set %%idx += 1 %end for -%%getSSOFilters }, "notificationStorage": "File", "applicationList": { @@ -168,7 +178,16 @@ %for att in %%casAttribute "%%att": "%%att.casLDAPAttribute", %end for -%%getSSOFilters +%set %%idx = 0 +%set %%size = %%len(%%ssoFilters) - 1 +%for key,value in %%ssoFilters + %if %%idx == %%size + "%%key": "%%key" + %else + "%%key": "%%key", + %end if + %set %%idx += 1 +%end for }, "issuerDBSAMLPath": "^/saml/", "samlAttributeAuthorityDescriptorAttributeServiceSOAP": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP;#PORTAL#/saml/AA/SOAP;",