From ef3334c5e436397ad9216b191a34013a31bcc4a2 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Fri, 13 Nov 2020 18:53:07 +0100 Subject: [PATCH] automatic scalar to list promotion allows to process all attributes consistently --- templates/other/accounts.php.tt2 | 6 +----- templates/web/edugain/create_accounts.tt2.html | 7 +------ templates/web/renater/create_accounts.tt2.html | 7 +------ 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/templates/other/accounts.php.tt2 b/templates/other/accounts.php.tt2 index 9cabafe..04acc33 100644 --- a/templates/other/accounts.php.tt2 +++ b/templates/other/accounts.php.tt2 @@ -9,11 +9,7 @@ $validTestAccounts = array ( '[% account.internal_uid() %]:{SHA256}[% account.password_hash() %]=' => array( 'internal_uid' => array([% account.internal_uid().quote %]), 'associatedSP' => array([% account.entityid().quote %]), - [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %] - [% NEXT UNLESS attributes.$attribute %] - '[% attribute %]' => array([% attributes.$attribute.quote("'") %]), - [% END %] - [% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] + [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName', 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] [% NEXT UNLESS attributes.$attribute %] '[% attribute %]' => array([% attributes.$attribute.quote("'").join(', ') %]), [% END %] diff --git a/templates/web/edugain/create_accounts.tt2.html b/templates/web/edugain/create_accounts.tt2.html index 56b8984..e32acc5 100644 --- a/templates/web/edugain/create_accounts.tt2.html +++ b/templates/web/edugain/create_accounts.tt2.html @@ -56,12 +56,7 @@ <div> <table> <caption>[% lh.maketext("List of user attributes") %]</caption> - [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %] - <tr> - <th>[% attribute %]</th><td>[% attributes.$attribute %]</td> - </tr> - [% END %] - [% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] + [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName', 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] <tr> <th>[% attribute %]</th><td>[% attributes.$attribute.join(', ') %]</td> </tr> diff --git a/templates/web/renater/create_accounts.tt2.html b/templates/web/renater/create_accounts.tt2.html index a8bc3f2..9f5623b 100644 --- a/templates/web/renater/create_accounts.tt2.html +++ b/templates/web/renater/create_accounts.tt2.html @@ -58,12 +58,7 @@ <div> <table> <caption>[% lh.maketext("List of user attributes") %]</caption> - [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %] - <tr> - <th>[% attribute %]</th><td>[% attributes.$attribute %]</td> - </tr> - [% END %] - [% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] + [% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName', 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %] <tr> <th>[% attribute %]</th><td>[% attributes.$attribute.join(', ') %]</td> </tr> -- GitLab