grouping attributes in consent UI
Peter Schober
peter.schober at univie.ac.at
Fri May 25 01:01:44 EDT 2018
* Peter Schober <peter.schober at univie.ac.at> [2018-05-23 16:15]:
> I played around with Velocity a bit but is there any interest in
> providing an easier (or even out-of-the-box) way to group related
> attributes on the consent UI?
FYI, I've now implemented this within the Velocity template. It's not
pretty and depends on the internal ids of the attributes as defined in
the local resolver, but it works:
Within the iteration over all attributes within
views/intercept/attribute-release.vm:
#foreach ($attribute in $attributeReleaseContext.getConsentableAttributes().values())
I simply test each individual $attribute.id to see what "attribute
(display) group" it's part of and assign a grouping-specific CSS
properties to the HTML.
I.e., I currently repeat the existing tr and td generation (unmodified
except for the CSS class) and also the
#foreach ($value in $attribute.values)
loop within every of those if/else occurances.
## NAMES
#if ($attribute.id == "givenName" || $attribute.id == "surname" || $attribute.id == "displayName")
<tr class="collapse names"> ## etc.
#end
## EMAIL
#if ($attribute.id == "mail")
<tr class="collapse mail"> ## etc
#end
## IDENTIFIERS
#if ($attribute.id == "uid" || $attribute.id == "eduPersonPrincipalName"
|| $attribute.id == "eduPersonUniqueId"
|| $attribute.id == "subjectID" || $attribute.id == "pairwiseID")
<tr class="collapse id"> ## etc
#end
## AFFILIATION
#if ($attribute.id == "eduPersonScopedAffiliation"
|| $attribute.id == "eduPersonEntitlement" || $attribute.id == "schacHomeOrganization")
<tr class="collapse affil"> ## etc
#end
So these are my 4 categories based on what my own IDP has defined.
(YMMV, of course, esp if you do lots of one-off vendor integrations.)
I should probably turn these into if/elseif/else so that in case I
later add more attributes these will fall through to the else section
gracefully, instead of not appearing at all.
The rest is then simply adding a bit of CSS/JS and clickable elements
to expand/collapse the desired section (or all sections at once, "Show
details"; which I'd still like to implement).
If I manage to polish up the UI a bit I can send a screenshot.
-peter
More information about the dev
mailing list