grouper-users - Re: [grouper-users] displaying multi-valued attributes in Entity/Member details
Subject: Grouper Users - Open Discussion List
List archive
Re: [grouper-users] displaying multi-valued attributes in Entity/Member details
Chronological Thread
- From: Dominique Petitpierre <>
- To: Chris Hyzer <>
- Cc: "" <>
- Subject: Re: [grouper-users] displaying multi-valued attributes in Entity/Member details
- Date: Wed, 05 Sep 2012 04:48:10 +0200
- Organization: University of Geneva
Hello,
On 09/04/2012 02:00 AM, Chris Hyzer wrote:
> I created a Jira:
>
> https://bugs.internet2.edu/jira/browse/GRP-841
>
> Its not easy to fix since multi-valued subject attributes have not been an
> often-used feature of Grouper and could use some attention. e.g. in WS you
> cannot get multi-valued attributes back in separate distinct values...
OK, thanks!
In the meantime, for those who need something now or for an earlier
release, here is an example of a workaround using the
subjectVirtualAttribute feature (tested on Grouper 1.6.3 and 2.1.1):
In grouper/WEB-INF/classes/sources.xml add the following lines (in
this context case is significant in the attribute names which is
useful to keep the same spelling):
<init-param>
<param-name>subjectVirtualAttribute_0_EmployeeType</param-name>
<param-value>
${subject.getAttributeValueOrCommaSeparated('employeeType')?:""}
</param-value>
</init-param>
If needed, change the subject.attributes.order.<source_id> parameter
in grouper/WEB-INF/classes/resources/grouper/media.properties to
include EmployeeType (instead of employeeType), e.g.
subject.attributes.order.mytest=description,EmployeeType,mail,subjectType,id
After restarting the application server the values of employeeType
will be displayed separated by a comma and a space. E.g:
EmployeeType student, staff
If the values are very long (e.g. values of organizationalUnitName)
and are displayed on many lines, the commas might be difficult to
see. One could then create multiple virtual attributes. E.g.:
<init-param>
<param-name>subjectVirtualAttribute_0_employeeType1</param-name>
<param-value>
${subjectUtils.defaultIfNull(subject.getAttributeValueOrCommaSeparated('employeeType'),"").replaceFirst(",.*","")}
</param-value>
</init-param>
<init-param>
<param-name>subjectVirtualAttribute_0_employeeType2</param-name>
<param-value>
${subjectUtils.defaultIfNull(subject.getAttributeValueOrCommaSeparated('employeeType'),"").replaceFirst("^[^,]*(,
)?([^,]*).*","$2")}
</param-value>
</init-param>
<init-param>
<param-name>subjectVirtualAttribute_0_employeeType3</param-name>
<param-value>
${subjectUtils.defaultIfNull(subject.getAttributeValueOrCommaSeparated('employeeType'),"").replaceFirst("^[^,]*(,
)?[^,]*(, )?([^,]*).*","$3")}
</param-value>
</init-param>
For the same example values, they will be displayed like this:
employeeType1 student
employeeType2 staff
employeeType3
If the very long values contain commas, it's becoming complicated with
JEXL expressions. But a generic solution like the one described in
https://bugs.internet2.edu/jira/browse/GRP-841 would be simpler and
better.
References:
Grouper GRP-390, allow virtual attributes for subjects
https://bugs.internet2.edu/jira/browse/GRP-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
Grouper Training – Admin – Subject API – Part 3
http://www.internet2.edu/grouper/training/admin/subject_api/admin-subject_api-part3-01.pptx
Java Expression Language, Commons JEXL Syntax
http://commons.apache.org/jexl/reference/syntax.html
Best regards,
Dominique
--
Mr Dominique Petitpierre, user=Dominique.Petitpierre domain=unige.ch
IT Division, University of Geneva, Switzerland
- [grouper-users] displaying multi-valued attributes in Entity/Member details, Dominique Petitpierre, 09/03/2012
- RE: [grouper-users] displaying multi-valued attributes in Entity/Member details, Chris Hyzer, 09/03/2012
- Re: [grouper-users] displaying multi-valued attributes in Entity/Member details, Dominique Petitpierre, 09/04/2012
- RE: [grouper-users] displaying multi-valued attributes in Entity/Member details, Chris Hyzer, 09/03/2012
Archive powered by MHonArc 2.6.16.