From 293d940fdcf75922f7ea2e86b8f0f585031955cf Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 3 Feb 2021 17:18:18 +0100 Subject: [PATCH] Adding ldapExportedVars --- tmpl/lmConf-1.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tmpl/lmConf-1.json b/tmpl/lmConf-1.json index 4304c35..c9a64c3 100644 --- a/tmpl/lmConf-1.json +++ b/tmpl/lmConf-1.json @@ -1,19 +1,25 @@ %set %%boolean = {'oui': 1, 'non': 0} %set %%ssoFilters = %%getSSOFilters +%set %%ldapAttributes = {"uid": "uid", "mail": "mail", "cn":"cn"} %set %%exported_vars = ['"UA": "HTTP_USER_AGENT"'] %set %%cas_attributes = [] -%set %%ldap_attributes = ['"uid": "uid"', '"mail": "mail"','"cn":"cn"'] +%set %%ldap_attributes = {} %for %%attr in %%casAttribute %silent %%exported_vars.append('"' + %%attr + '": "' + %%attr.casLDAPAttribute + '"') %silent %%cas_attributes.append('"' + %%attr + '": "' + %%attr.casLDAPAttribute + '"') - %silent %%ldap_attributes.append('"' + %%attr.casLDAPAttribute + '": "' + %%attr.casLDAPAttribute + '"') + %set %%ldap_attributes[%%attr.casLDAPAttribute] = %%attr.casLDAPAttribute %end for %for %%key, %%value in %%ssoFilters %silent %%exported_vars.append('"' + %%key + '": "' + %%value + '"') %silent %%cas_attributes.append('"' + %%key + '": "' + %%value + '"') + %set %%ldap_attributes[%%value] = %%value %end for %silent %%exported_vars.sort() %silent %%cas_attributes.sort() +%set %%ldapAttr = [] +%for %%k, %%v in %%ldap_attributes.items() + %silent %%ldapAttr.append('"' + %%k + '": "' + %%v + '"') +%end for { %if %%lemon_user_db == "AD" "ADPwdExpireWarning": %%llADPasswordExpireWarn, @@ -175,7 +181,7 @@ "ldapSearchDeref": "find", "ldapBase": "%%ldapUserBaseDN", "ldapExportedVars": { - %%custom_join(%%ldap_attributes, ',\n ') + %%custom_join(%%ldapAttr, ',\n ') }, "ldapGroupAttributeName": "memberUid", "ldapGroupAttributeNameGroup": "dn",