Help with MappedAttributeDefinition

Wessel, Keith kwessel at illinois.edu
Fri Aug 19 01:58:19 UTC 2022


The problem is your map is evaluating every value of eduPersonAffiliation. Any chance you could do what you’re hoping with something single-valued like eduPersonPrimaryAffiliation?

Shy of that, I think your best bet is a script. Set the attribute to 0 at the beginning. Then iterate over all values of eduPersonAffiliation in a for loop. If you find “student”, change that variable to 1. Should be a pretty simple script.

Keith


From: users <users-bounces at shibboleth.net> On Behalf Of Mohamed Lrhazi via users
Sent: Thursday, August 18, 2022 6:26 PM
To: Shib Users <users at shibboleth.net>
Cc: Mohamed Lrhazi <lrhazi at cua.edu>
Subject: Help with MappedAttributeDefinition

Hello,

I am trying to add an attribute that resolves to "1" if the user is a student, but "0" otherwise... I thought it would be as simple as below.... but this actually returns "1" and "0" if the user is both a student and also a member or any other affiliation....

How do I implement this logic?

Thanks a lot!
Mohamed.



    <AttributeDefinition id="isEligible" xsi:type="Mapped">
        <InputDataConnector ref="sqliteConnector" attributeNames="eduPersonAffiliation"/>
        <DefaultValue>0</DefaultValue>
        <ValueMap>
            <ReturnValue>1</ReturnValue>
            <SourceValue>student</SourceValue>
       </ValueMap>
       <AttributeEncoder xsi:type="SAML1String" name="isEligible" encodeType="false" />
       <AttributeEncoder xsi:type="SAML2String" name="isEligible" friendlyName="isEligible" encodeType="false" />
    </AttributeDefinition>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20220819/bde79d6e/attachment.htm>


More information about the users mailing list