Adding ldapExportedVars

This commit is contained in:
Philippe Caseiro 2021-02-03 17:18:18 +01:00
parent 918ceab882
commit 293d940fdc
1 changed files with 9 additions and 3 deletions

View File

@ -1,19 +1,25 @@
%set %%boolean = {'oui': 1, 'non': 0} %set %%boolean = {'oui': 1, 'non': 0}
%set %%ssoFilters = %%getSSOFilters %set %%ssoFilters = %%getSSOFilters
%set %%ldapAttributes = {"uid": "uid", "mail": "mail", "cn":"cn"}
%set %%exported_vars = ['"UA": "HTTP_USER_AGENT"'] %set %%exported_vars = ['"UA": "HTTP_USER_AGENT"']
%set %%cas_attributes = [] %set %%cas_attributes = []
%set %%ldap_attributes = ['"uid": "uid"', '"mail": "mail"','"cn":"cn"'] %set %%ldap_attributes = {}
%for %%attr in %%casAttribute %for %%attr in %%casAttribute
%silent %%exported_vars.append('"' + %%attr + '": "' + %%attr.casLDAPAttribute + '"') %silent %%exported_vars.append('"' + %%attr + '": "' + %%attr.casLDAPAttribute + '"')
%silent %%cas_attributes.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 %end for
%for %%key, %%value in %%ssoFilters %for %%key, %%value in %%ssoFilters
%silent %%exported_vars.append('"' + %%key + '": "' + %%value + '"') %silent %%exported_vars.append('"' + %%key + '": "' + %%value + '"')
%silent %%cas_attributes.append('"' + %%key + '": "' + %%value + '"') %silent %%cas_attributes.append('"' + %%key + '": "' + %%value + '"')
%set %%ldap_attributes[%%value] = %%value
%end for %end for
%silent %%exported_vars.sort() %silent %%exported_vars.sort()
%silent %%cas_attributes.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" %if %%lemon_user_db == "AD"
"ADPwdExpireWarning": %%llADPasswordExpireWarn, "ADPwdExpireWarning": %%llADPasswordExpireWarn,
@ -175,7 +181,7 @@
"ldapSearchDeref": "find", "ldapSearchDeref": "find",
"ldapBase": "%%ldapUserBaseDN", "ldapBase": "%%ldapUserBaseDN",
"ldapExportedVars": { "ldapExportedVars": {
%%custom_join(%%ldap_attributes, ',\n ') %%custom_join(%%ldapAttr, ',\n ')
}, },
"ldapGroupAttributeName": "memberUid", "ldapGroupAttributeName": "memberUid",
"ldapGroupAttributeNameGroup": "dn", "ldapGroupAttributeNameGroup": "dn",