Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] Change delimiter for multivalued attributes returned by WS?

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] Change delimiter for multivalued attributes returned by WS?


Chronological Thread 
  • From: Baron Fujimoto <>
  • To: Grouper Users <>
  • Subject: Re: [grouper-users] Change delimiter for multivalued attributes returned by WS?
  • Date: Thu, 8 Sep 2022 14:59:49 -1000

For the archival benefit of the list, Chad Redman provided the following via the Grouper Slack channel:

${subject.getAttributeValues('uhOrgAffiliation') == null ? null : subjectUtils.forName('edu.internet2.middleware.grouper.util.GrouperUtil').join(subject.getAttributeValues('uhOrgAffiliation').iterator(), ':')}

This appears to work well for us with 2.2.2. We had some concerns that this would perhaps make multiple hits on our LDAP for these attributes, but Chad went above and beyond the call and, "Traced it, and definitely not making two ldap calls. The subject variable will have an attribute lookup cache, which is initially populated from the values from the single LDAP query. The getAttributeValues() method retrieves from this cache, so it doesn't need to look up anything again. The virtual attributes happen in a second phase, to further populate the cache with the calculation results"

On Tue, Sep 6, 2022 at 10:26 AM Baron Fujimoto <> wrote:
We've finally had a chance to circle back to our attempts to have the WS return all the values for multivalued attributes. With the advice provided previously, we were able to achieve this. For example, for an attribute "uhOrgAffiliation" we included the following in our sources.xml:

    <init-param>
        <param-name>subjectVirtualAttribute_0_uhOrgAffiliation</param-name>
            <param-value>
                ${subject.getAttributeValueOrCommaSeparated('uhOrgAffiliation')?:""}
        </param-value>
    </init-param>

This results in a comma-separated set of values for the attribute. However, this particular attribute's values themselves contain commas, so this makes the returned set of values more difficult to parse for each constituent value. E.g., for a set of source attribute values like:

uhOrgAffiliation: eduPersonOrgDN=kcc,eduPersonAffiliation=staff
uhOrgAffiliation: eduPersonOrgDN=lcc,eduPersonAffiliation=faculty
uhOrgAffiliation: eduPersonOrgDN=uhsystem,eduPersonAffiliation=staff

It returns:

eduPersonOrgDN=lcc,eduPersonAffiliation=faculty, eduPersonOrgDN=uhsystem,eduPersonAffiliation=staff, eduPersonOrgDN=kcc,eduPersonAffiliation=staff

(line wrapping may break that up, but each value is separated by a comma-space ", " – but I don't think we can rely on comma-space as a delimiter, because it's possible that some values may have their own comma-spaces)

Is there a way for us to change the delimiter for the returned values from a comma to, say, a colon ":"? I.e. so we wind up with something like this instead:

eduPersonOrgDN=lcc,eduPersonAffiliation=faculty:eduPersonOrgDN=uhsystem,eduPersonAffiliation=staff:eduPersonOrgDN=kcc,eduPersonAffiliation=staff

We are currently running Grouper 2.2.2
--
Baron Fujimoto <> ::: UH Information Technology Services
minutas cantorum, minutas balorum, minutas carboratum descendus pantorum


--
Baron Fujimoto <> ::: UH Information Technology Services
minutas cantorum, minutas balorum, minutas carboratum descendus pantorum



Archive powered by MHonArc 2.6.24.

Top of Page