Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
dc8a17d6
Commit
dc8a17d6
authored
6 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
formmat multi-valued attributes in templates
parent
1b180ce8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/AccountManager/Tools.pm
+13
-0
13 additions, 0 deletions
lib/AccountManager/Tools.pm
templates/accounts/accounts.php.tt2
+32
-27
32 additions, 27 deletions
templates/accounts/accounts.php.tt2
templates/web/en/create_accounts.tt2.html
+7
-2
7 additions, 2 deletions
templates/web/en/create_accounts.tt2.html
with
52 additions
and
29 deletions
lib/AccountManager/Tools.pm
+
13
−
0
View file @
dc8a17d6
...
...
@@ -10,6 +10,7 @@ use List::Util qw(shuffle);
use
List::
MoreUtils
qw(pairwise)
;
use
MIME::
Base64
;
use
Template
;
use
Template::
Stash
;
sub
encrypt
{
my
(
$string
,
$key
)
=
@_
;
...
...
@@ -94,6 +95,18 @@ sub generate_secret {
sub
update_ssp_authsources
{
my
(
$templates_dir
,
$output
,
$accounts
)
=
@_
;
# scalar virtual method to return a quoted value
$
Template::Stash::
SCALAR_OPS
->
{
quote
}
=
sub
{
my
$scalar
=
shift
;
return
"
'
"
.
$scalar
.
"
'
";
};
# list virtual method to return a list of quoted values
$
Template::Stash::
LIST_OPS
->
{
quote
}
=
sub
{
my
$list
=
shift
;
return
[
map
{
"
'
"
.
$_
.
"
'
"
}
@$list
];
};
my
$tt2
=
Template
->
new
({
ENCODING
=>
'
utf8
',
INCLUDE_PATH
=>
$templates_dir
.
'
/accounts
'
...
...
This diff is collapsed.
Click to expand it.
templates/accounts/accounts.php.tt2
+
32
−
27
View file @
dc8a17d6
[
%
MACRO
enumerate
(
list
)
BLOCK
-%
]
[
%
FOREACH
item
IN
list
-%
]
'[% item %]'
[
%
IF
!
loop
.
last
-%
],
[
%
END
-%
]
[
%
END
-%
]
[
%
END
-%
]
[
%
MACRO
print_attribute
(
account
,
attribute
)
BLOCK
-%
]
[
%
IF
account
.
$attribute
-%
]
'[% attribute %]'
=>
'[% account.$attribute %]'
,
[
%
END
-%
]
[
%
END
-%
]
[
%
MACRO
print_multivalued_attribute
(
account
,
attribute
)
BLOCK
-%
]
[
%
IF
account
.
$attribute
-%
]
'[% attribute %]'
=>
[
[
%
enumerate
(
account
.
$attribute
)
-%
]
],
[
%
END
-%
]
[
%
END
-%
]
<?php
// PhP configuration file loaded in simpleSamlPhp authsources.php file
$validTestAccounts
=
array
(
...
...
@@ -20,18 +5,38 @@ $validTestAccounts = array (
[
%
FOREACH
account
IN
accounts
-%
]
'user[% account.id() %]:{SHA256}[% account.password_hash() %]='
=>
array
(
[
%
print_attribute
(
account
,
'internal_uid'
)
-%
]
[
%
print_attribute
(
account
,
'cn'
)
-%
]
[
%
print_attribute
(
account
,
'displayName'
)
-%
]
[
%
print_attribute
(
account
,
'givenName'
)
-%
]
[
%
print_attribute
(
account
,
'sn'
)
-%
]
[
%
print_attribute
(
account
,
'mail'
)
-%
]
[
%
print_multivalued_attribute
(
account
,
'eduPersonAffiliation'
)
-%
]
[
%
print_multivalued_attribute
(
account
,
'eduPersonScopedAffiliation'
)
-%
]
[
%
print_attribute
(
account
,
'eduPersonPrincipalName'
)
-%
]
[
%
print_attribute
(
account
,
'schacHomeOrganization'
)
-%
]
[
%
print_attribute
(
account
,
'schacHomeOrganizationType'
)
-%
]
[
%
print_attribute
(
account
,
'associatedSP'
)
-%
]
'internal_uid'
=>
array
([
%
account
.
internal_uid
()
.
quote
%
]),
'associatedSP'
=>
array
([
%
account
.
associatedSP
()
.
quote
%
]),
[
%
IF
account
.
cn
()
-%
]
'cn'
=>
array
([
%
account
.
cn
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
sn
()
-%
]
'sn'
=>
array
([
%
account
.
sn
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
displayName
()
-%
]
'displayName'
=>
array
([
%
account
.
displayName
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
givenName
()
-%
]
'givenName'
=>
array
([
%
account
.
givenName
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
mail
()
-%
]
'mail'
=>
array
([
%
account
.
mail
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
eduPersonAffiliation
()
-%
]
'eduPersonAffiliation'
=>
array
([
%
account
.
eduPersonAffiliation
()
.
quote
.
join
(
', '
)
%
]),
[
%
END
-%
]
[
%
IF
account
.
eduPersonScopedAffiliation
()
-%
]
'eduPersonScopedAffiliation'
=>
array
([
%
account
.
eduPersonScopedAffiliation
()
.
quote
.
join
(
', '
)
%
]),
[
%
END
-%
]
[
%
IF
account
.
eduPersonPrincipalName
()
-%
]
'eduPersonPrincipalName'
=>
array
([
%
account
.
eduPersonPrincipalName
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
schacHomeOrganization
()
-%
]
'schacHomeOrganization'
=>
array
([
%
account
.
schacHomeOrganization
()
.
quote
%
]),
[
%
END
-%
]
[
%
IF
account
.
schacHomeOrganizationType
()
-%
]
'schacHomeOrganizationType'
=>
array
([
%
account
.
schacHomeOrganizationType
()
.
quote
%
]),
[
%
END
-%
]
),
[
%
END
-%
]
...
...
This diff is collapsed.
Click to expand it.
templates/web/en/create_accounts.tt2.html
+
7
−
2
View file @
dc8a17d6
...
...
@@ -49,9 +49,14 @@ provider.</p>
<div>
<table>
<caption>
List of user attributes
</caption>
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName'
, 'eduPersonAffiliation', 'eduPersonScopedAffiliation'
] -%]
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] -%]
<tr>
<th>
[% attribute %]
</th><td>
[% account.$attribute %]
</td>
<th>
[% attribute %]
</th><td>
[% account.$attribute() %]
</td>
</tr>
[% END %]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] -%]
<tr>
<th>
[% attribute %]
</th><td>
[% account.$attribute().join(', ') %]
</td>
</tr>
[% END %]
<tr>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment