gabaurre1 Absent Member.
Absent Member.
717 views

Add association-ref to a structured attribute

I am not being able to add association-ref value to ACL attribute. This is an structured attribute and I need to add it to a specific attribute component. I put the input value and the output value I want.

Before.

<add-attr attr-name="ACL">
<value timestamp="1346117957#14" type="structured">
<component name="protectedName">[All Attributes Rights]</component>
<component name="trustee">\IDV\novell\users</component>
<component name="privileges">3</component>
</value>

After

<add-attr attr-name="ACL">
<value timestamp="1346117957#14" type="structured">
<component name="protectedName">[All Attributes Rights]</component>
<component association-ref="{EB406155-75E0-2b40-378C-EB40615575E0}" name="trustee">\IDV\novell\users</component>
<component name="privileges">3</component>
</value>

The last XPath expression I tried was:

<do-set-xml-attr expression="../modify[last()]/modify-attr[last()]/add-value[last()]/value[last()]/component[@name=trustee][last()]" name="association-ref">
<arg-string>
<token-local-variable name="lv-Sub-Trustee-Assoc"/>
</arg-string>
</do-set-xml-attr>

Where is the problem in the XPath expression?

Thanks.

Gustavo
Labels (1)
0 Likes
6 Replies
Knowledge Partner
Knowledge Partner

Re: Add association-ref to a structured attribute

Pretty sure it should be something like this.

<do-set-xml-attr
expression="../modify[last()]/modify-attr[last()]/add-attr[@attr-name=‘ACL’][last()]/value[last()]/component[@name=trustee][last()]"
name="association-ref"> <arg-string>
<token-local-variable name="lv-Sub-Trustee-Assoc"/> </arg-string>
</do-set-xml-attr>
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
Knowledge Partner
Knowledge Partner

Re: Add association-ref to a structured attribute

gabaurre;2493179 wrote:
I am not being able to add association-ref value to ACL attribute. This is an structured attribute and I need to add it to a specific attribute component. I put the input value and the output value I want.

Before.

<add-attr attr-name="ACL">
<value timestamp="1346117957#14" type="structured">
<component name="protectedName">[All Attributes Rights]</component>
<component name="trustee">\IDV\novell\users</component>
<component name="privileges">3</component>
</value>

After

<add-attr attr-name="ACL">
<value timestamp="1346117957#14" type="structured">
<component name="protectedName">[All Attributes Rights]</component>
<component association-ref="{EB406155-75E0-2b40-378C-EB40615575E0}" name="trustee">\IDV\novell\users</component>
<component name="privileges">3</component>
</value>

The last XPath expression I tried was:

<do-set-xml-attr expression="../modify[last()]/modify-attr[last()]/add-value[last()]/value[last()]/component[@name=trustee][last()]" name="association-ref">
<arg-string>
<token-local-variable name="lv-Sub-Trustee-Assoc"/>
</arg-string>
</do-set-xml-attr>

Where is the problem in the XPath expression?

Thanks.

Gustavo


This would be better asked in the engine-drivers forum. This one is intended for questions about IDM Designer, the product.

Anyway, your XPath has a couple of problems.

1. You don't need the ../modify part. Or any of the uses of last().

2. Your sample shows an <add-attr>, which would only be part of an <add>, not a <modify>.

3. You need quotes around "trustee"...


This:


modify-attr[@attr-name="ACL"]/add-value/value/component[@name="trustee"]


seems to do what you're looking for, on a <modify> event, where you're adding the ACL. I'm not sure why you're adding association-ref to it, that's not something I've ever needed to do, but there you go.
0 Likes
gabaurre1 Absent Member.
Absent Member.

Re: Add association-ref to a structured attribute

I found the problem. It is necessry to add double quotes before and after the component name. The correct action is:

<do-set-xml-attr expression="../modify[last()]/modify-attr[last()]/add-value[last()]/value[last()]/component[@name="trustee"][last()]" name="association-ref">
<arg-string>
<token-local-variable name="lv-Sub-Trustee-Assoc"/>
</arg-string>
</do-set-xml-attr>

Thank you all for your support.
0 Likes
Knowledge Partner
Knowledge Partner

Re: Add association-ref to a structured attribute

>> <do-set-xml-attr
>> expression="../modify[last()]/modify-attr[last()]/add-value[last()]/value[last()]/component[@name=trustee][last()]"
>> name="association-ref">
>> <arg-string>
>> <token-local-variable name="lv-Sub-Trustee-Assoc"/>
>> </arg-string>
>> </do-set-xml-attr>
>>

> Anyway, your XPath has a couple of problems.
>
> 1. You don't need the ../modify part. Or any of the uses of last().


Yes to ../modify but not to last(). Probably a good idea to use them,
depending on what else is in the doc.

> 2. Your sample shows an <add-attr>, which would only be part of an
> <add>, not a <modify>.
>
> 3. You need quotes around "trustee"...


That is most likely the issue.

>
> This:
>
>
> Code:
> --------------------
>
> modify-attr[@attr-name="ACL"]/add-value/value/component[@name="trustee"]
>
> --------------------
>
>
> seems to do what you're looking for, on a <modify> event, where you're
> adding the ACL. I'm not sure why you're adding association-ref to it,
> that's not something I've ever needed to do, but there you go.
>
>


0 Likes
Knowledge Partner
Knowledge Partner

Re: Add association-ref to a structured attribute

geoffc;2493194 wrote:
>> <do-set-xml-attr
>> expression="../modify[last()]/modify-attr[last()]/add-value[last()]/value[last()]/component[@name=trustee][last()]"
>> name="association-ref">
>> <arg-string>
>> <token-local-variable name="lv-Sub-Trustee-Assoc"/>
>> </arg-string>
>> </do-set-xml-attr>
>>

> Anyway, your XPath has a couple of problems.
>
> 1. You don't need the ../modify part. Or any of the uses of last().


Yes to ../modify but not to last(). Probably a good idea to use them,
depending on what else is in the doc.

> 2. Your sample shows an <add-attr>, which would only be part of an
> <add>, not a <modify>.
>
> 3. You need quotes around "trustee"...


That is most likely the issue.

>
> This:
>
>
> Code:
> --------------------
>
> modify-attr[@attr-name="ACL"]/add-value/value/component[@name="trustee"]
>
> --------------------
>
>
> seems to do what you're looking for, on a <modify> event, where you're
> adding the ACL. I'm not sure why you're adding association-ref to it,
> that's not something I've ever needed to do, but there you go.
>
>



Maybe, maybe not on the use of last(). If this is something that's being generated in policy, so you know that the one you want is the last one, sure. If it's something coming in to the rule from wherever, maybe not.
0 Likes
Knowledge Partner
Knowledge Partner

Re: Add association-ref to a structured attribute

dgersic wrote:

> Maybe, maybe not on the use of last(). If this is something that's being
> generated in policy, so you know that the one you want is the last one,
> sure. If it's something coming in to the rule from wherever, maybe not.


It is a good habit, I think. Otherwise your rules are less portable. If you
move them to a context where it is relevant (like inside a loop) then you find
that last() helps in policy.


--
If you find this post helpful, and are viewing this using the web, please show
your appreciation by clicking on the star below
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
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.