Anonymous_User Absent Member.
Absent Member.
231 views

99 Attributes from app to one attribute in eDir


Okay, I am getting up to 99 attributes from my application that need to
be mapped to a single multi-valued attribute in eDirectory, and all
attributes are sent with every transactions. So, I would get something
like:

<add class-name="user">
<add-attr attr-name="ALTEMAIL01">
<value type="string">ALTEMAIL01</value>
</add-attr>
<add-attr attr-name="ALTEMAIL02">
<value type="string">ALTEMAIL02</value>
</add-attr>
<add-attr attr-name="ALTEMAIL03">
<value type="string">ALTEMAIL03</value>
</add-attr>
<add-attr attr-name="ALTEMAIL04">
<value type="string">ALTEMAIL04</value>
</add-attr>
<add-attr attr-name="ALTEMAIL05">
<value type="string">ALTEMAIL05</value>
</add-attr>

....

<add-attr attr-name="ALTEMAIL99">
<value type="string">ALTEMAIL99</value>
</add-attr>
</add>

Now, all 99 attributes need to go into a single aux eDirectory
attributes of ALTEMAIL. Just because I get three values, does not mean
the values would be in the attributes ALTEMAIL01, ALTEMAIL02, and
ALTEMAIL03, they could be in ALTEMAIL21, ALTEMAIL55, and ALTEMAIL89.

I know the best place to do this would be the input transformation, and
if it was only 5-10 attributes I could do it in policy builder without
too much problem. With something like:

<rule>
<description>Join ALTEMAIL</description>
<comment xml:space="preserve">Values of ALTEMAIL01 - 05 should be
joined into a single attribute of ALTEMAIL</comment>
<conditions>
<or>
<if-op-attr name="ALTEMAIL01" op="available"/>
<if-op-attr name="ALTEMAIL02" op="available"/>
<if-op-attr name="ALTEMAIL03" op="available"/>
<if-op-attr name="ALTEMAIL04" op="available"/>
<if-op-attr name="ALTEMAIL05" op="available"/>
</or>
</conditions>
<actions>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="ALTEMAIL01"
op="equal">.+</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-add-dest-attr-value name="ALTEMAIL">
<arg-value type="string">
<token-op-attr name="ALTEMAIL01"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="ALTEMAIL02"
op="equal">.+</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-add-dest-attr-value name="ALTEMAIL">
<arg-value type="string">
<token-op-attr name="ALTEMAIL02"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="ALTEMAIL03"
op="equal">.+</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-add-dest-attr-value name="ALTEMAIL">
<arg-value type="string">
<token-op-attr name="ALTEMAIL03"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="ALTEMAIL04"
op="equal">.+</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-add-dest-attr-value name="ALTEMAIL">
<arg-value type="string">
<token-op-attr name="ALTEMAIL04"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="ALTEMAIL05"
op="equal">.+</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-add-dest-attr-value name="ALTEMAIL">
<arg-value type="string">
<token-op-attr name="ALTEMAIL05"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions/>
</do-if>
</actions>
</rule>

However, when using 99 attributes, that code begins to look a bit
messing and slow. Anyone have any ideas on how to make the code faster
and look better?

Thanks,

Bob


--
bstumpp
------------------------------------------------------------------------
bstumpp's Profile: https://forums.netiq.com/member.php?userid=2783
View this thread: https://forums.netiq.com/showthread.php?t=49561

Labels (1)
0 Likes
8 Replies
Anonymous_User Absent Member.
Absent Member.

Re: 99 Attributes from app to one attribute in eDir


Hi Bob,
I use driver GCV with name of attributes.
I will give you example of my code, that used for manipulations with
phone related attributes.

In your case, you can put all your altermail01 – 99 to gcv. Policy code
will be exact same.


GCV:

> <definition critical-change="true" display-name="List of Phone
> Attributes" item-separator=";" name="gcvPhoneAttributesList"
> type="list">
> <description>List of Phone Attributes</description>
> <value>
> <item>Telephone Number</item>
> <item>mobile</item>
> <item>Facsimile Telephone Number</item>
> </value>
> </definition>
>


Policy:

> <do-for-each>
> <arg-node-set>
> <token-global-variable name="gcvPhoneAttributesList"/>
> </arg-node-set>
> <arg-actions>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr name="$current-node$" op="changing"/>
> <if-op-attr name="$current-node$" op="not-available"/>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-strip-op-attr name="$current-node$"/>
> <do-clear-dest-attr-value name="$current-node$"/>
> </arg-actions>
> <arg-actions/>
> </do-if>
> </arg-actions>
> </do-for-each>


Alex

bstumpp;238557 Wrote:
> Okay, I am getting up to 99 attributes from my application that need to
> be mapped to a single multi-valued attribute in eDirectory, and all
> attributes are sent with every transactions. So, I would get something
> like:
>
> <add class-name="user">
> <add-attr attr-name="ALTEMAIL01">
> <value type="string">ALTEMAIL01</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL02">
> <value type="string">ALTEMAIL02</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL03">
> <value type="string">ALTEMAIL03</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL04">
> <value type="string">ALTEMAIL04</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL05">
> <value type="string">ALTEMAIL05</value>
> </add-attr>
>
> ....
>
> <add-attr attr-name="ALTEMAIL99">
> <value type="string">ALTEMAIL99</value>
> </add-attr>
> </add>
>
> Now, all 99 attributes need to go into a single aux eDirectory
> attributes of ALTEMAIL. Just because I get three values, does not mean
> the values would be in the attributes ALTEMAIL01, ALTEMAIL02, and
> ALTEMAIL03, they could be in ALTEMAIL21, ALTEMAIL55, and ALTEMAIL89.
>
> I know the best place to do this would be the input transformation, and
> if it was only 5-10 attributes I could do it in policy builder without
> too much problem. With something like:
>
> <rule>
> <description>Join ALTEMAIL</description>
> <comment xml:space="preserve">Values of ALTEMAIL01 - 05 should be
> joined into a single attribute of ALTEMAIL</comment>
> <conditions>
> <or>
> <if-op-attr name="ALTEMAIL01" op="available"/>
> <if-op-attr name="ALTEMAIL02" op="available"/>
> <if-op-attr name="ALTEMAIL03" op="available"/>
> <if-op-attr name="ALTEMAIL04" op="available"/>
> <if-op-attr name="ALTEMAIL05" op="available"/>
> </or>
> </conditions>
> <actions>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL01"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL01"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL02"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL02"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL03"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL03"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL04"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL04"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL05"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL05"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> </actions>
> </rule>
>
> However, when using 99 attributes, that code begins to look a bit
> messing and slow. Anyone have any ideas on how to make the code faster
> and look better?
>
> Thanks,
>
> Bob



--
al_b
------------------------------------------------------------------------
al_b's Profile: https://forums.netiq.com/member.php?userid=209
View this thread: https://forums.netiq.com/showthread.php?t=49561

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: 99 Attributes from app to one attribute in eDir


I knew someone would be help me out. Now to see about putting this
wonderful idea to work.


--
bstumpp
------------------------------------------------------------------------
bstumpp's Profile: https://forums.netiq.com/member.php?userid=2783
View this thread: https://forums.netiq.com/showthread.php?t=49561

0 Likes
dcreedy Absent Member.
Absent Member.

Re: 99 Attributes from app to one attribute in eDir

On 12/23/2013 3:19 PM, bstumpp wrote:
>
> Okay, I am getting up to 99 attributes from my application that need to
> be mapped to a single multi-valued attribute in eDirectory, and all
> attributes are sent with every transactions. So, I would get something
> like:
>
> <add class-name="user">
> <add-attr attr-name="ALTEMAIL01">
> <value type="string">ALTEMAIL01</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL02">
> <value type="string">ALTEMAIL02</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL03">
> <value type="string">ALTEMAIL03</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL04">
> <value type="string">ALTEMAIL04</value>
> </add-attr>
> <add-attr attr-name="ALTEMAIL05">
> <value type="string">ALTEMAIL05</value>
> </add-attr>
>
> ....
>
> <add-attr attr-name="ALTEMAIL99">
> <value type="string">ALTEMAIL99</value>
> </add-attr>
> </add>
>
> Now, all 99 attributes need to go into a single aux eDirectory
> attributes of ALTEMAIL. Just because I get three values, does not mean
> the values would be in the attributes ALTEMAIL01, ALTEMAIL02, and
> ALTEMAIL03, they could be in ALTEMAIL21, ALTEMAIL55, and ALTEMAIL89.
>
> I know the best place to do this would be the input transformation, and
> if it was only 5-10 attributes I could do it in policy builder without
> too much problem. With something like:
>
> <rule>
> <description>Join ALTEMAIL</description>
> <comment xml:space="preserve">Values of ALTEMAIL01 - 05 should be
> joined into a single attribute of ALTEMAIL</comment>
> <conditions>
> <or>
> <if-op-attr name="ALTEMAIL01" op="available"/>
> <if-op-attr name="ALTEMAIL02" op="available"/>
> <if-op-attr name="ALTEMAIL03" op="available"/>
> <if-op-attr name="ALTEMAIL04" op="available"/>
> <if-op-attr name="ALTEMAIL05" op="available"/>
> </or>
> </conditions>
> <actions>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL01"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL01"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL02"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL02"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL03"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL03"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL04"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL04"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> <do-if>
> <arg-conditions>
> <and>
> <if-op-attr mode="regex" name="ALTEMAIL05"
> op="equal">.+</if-op-attr>
> </and>
> </arg-conditions>
> <arg-actions>
> <do-add-dest-attr-value name="ALTEMAIL">
> <arg-value type="string">
> <token-op-attr name="ALTEMAIL05"/>
> </arg-value>
> </do-add-dest-attr-value>
> </arg-actions>
> <arg-actions/>
> </do-if>
> </actions>
> </rule>
>
> However, when using 99 attributes, that code begins to look a bit
> messing and slow. Anyone have any ideas on how to make the code faster
> and look better?
>
> Thanks,
>
> Bob
>
>

I would try using a for-each loop with
XPath("add-attr[starts-with(@attr-name,'ALTEMAIL')]")
as the nodeset to start.

Daryl
0 Likes
Knowledge Partner
Knowledge Partner

Re: 99 Attributes from app to one attribute in eDir

bstumpp wrote:

> Now, all 99 attributes need to go into a single aux eDirectory
> attributes of ALTEMAIL.


This rule should do what you need, for add, modify and instance events:

<rule>
<description>Consolidate ALTEMAIL* attributes</description>
<comment name="author" xml:space="preserve">Lothar Haeger</comment>
<conditions>
<and/>
</conditions>
<actions>
<do-rename-op-attr dest-name="OLDMAIL" src-name="ALTEMAIL01"/>
<do-clone-xpath
dest-expression='.//value[ancestor::*/@attr-name="OLDMAIL"]/..'
src-expression='.//value[starts-with(ancestor::*/@attr-name,"ALTEMAIL")]'/>
<do-strip-xpath expression='.//*[starts-with(@attr-name,"ALTEMAIL")]'/>
<do-rename-op-attr dest-name="ALTEMAIL" src-name="OLDMAIL"/>
</actions>
</rule>
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Knowledge Partner
Knowledge Partner

Re: 99 Attributes from app to one attribute in eDir

Lothar Haeger wrote:

> This rule should do what you need, for add, modify and instance events:


Well, almost. I missed the part about not every attr always being in the
operation. You better try:

<rule>
<description>Consolidate ALTEMAIL* attributes</description>
<comment name="author" xml:space="preserve">Lothar Haeger</comment>
<conditions/>
<actions>
<do-set-xml-attr expression='.//*[starts-with(@attr-name,"ALTEMAIL")][1]'
name="attr-name">
<arg-string>
<token-text xml:space="preserve">OLDMAIL</token-text>
</arg-string>
</do-set-xml-attr>
<do-clone-xpath
dest-expression='.//value[ancestor::*/@attr-name="OLDMAIL"]/..'
src-expression='.//value[starts-with(ancestor::*/@attr-name,"ALTEMAIL")]'/>
<do-strip-xpath expression='.//*[starts-with(@attr-name,"ALTEMAIL")]'/>
<do-rename-op-attr dest-name="ALTEMAIL" src-name="OLDMAIL"/>
</actions>
</rule>
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: 99 Attributes from app to one attribute in eDir


And the ideas keep rolling in... Taking a break over the holidays, but
I will be getting back into it in the new year. Once I decide how I am
going to do it, I will let everyone know. But keep the ideas coming...


--
bstumpp
------------------------------------------------------------------------
bstumpp's Profile: https://forums.netiq.com/member.php?userid=2783
View this thread: https://forums.netiq.com/showthread.php?t=49561

0 Likes
Knowledge Partner
Knowledge Partner

Re: 99 Attributes from app to one attribute in eDir

bstumpp wrote:

> But keep the ideas coming...


Well, actually if you only need add and instance support (i.e. your app always
sends adds, instances resulting from match/merge scenarios), this one-liner
would probably also work:

<do-set-xml-attr expression='.//*[starts-with(@attr-name,"ALTEMAIL")]'
name="attr-name">
<arg-string>
<token-text xml:space="preserve">ALTEMAIL</token-text>
</arg-string>
</do-set-xml-attr>

The output doc does not look as pretty, but the code is more concise. Even on
Xmas you can't have it all....
______________________________________________
https://www.is4it.de/identity-access-management
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: 99 Attributes from app to one attribute in eDir


I am going with the last option entered. Since all documents are add
documents, using:

<do-set-xml-attr
expression='.//*[starts-with(@attr-name,"XMLALTEMAIL")]'
name="attr-name">
<arg-string>
<token-text xml:space="preserve">XMLALTEMAIL</token-text>
</arg-string>
</do-set-xml-attr>

Seemed to me to be the best, shortest, fastest, option.

Thanks for everyone's assistance.


--
bstumpp
------------------------------------------------------------------------
bstumpp's Profile: https://forums.netiq.com/member.php?userid=2783
View this thread: https://forums.netiq.com/showthread.php?t=49561

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.