[midPoint] How to check that user is assigned to selected resource?
Pavol Mederly
mederly at evolveum.com
Fri Jun 26 11:06:36 CEST 2015
Roman,
very quickly, because I have to go just now:
I would check directly the assignments, like this:
(This is a quickly hacked mapping that assigns "Directly under root"
value for all Orgs that have assignment with a given targetRef. For
resources, you have to work with getConstruction().getResourceRef().)
<mapping>
<strength>strong</strength>
<source>
<c:path>assignment</c:path>
</source>
<expression>
<value>Directly under root</value>
</expression>
<target>
<c:path>description</c:path>
</target>
<condition>
<script>
<relativityMode>absolute</relativityMode>
<code>
log.info('assignment = {}', assignment) //
assignment is a PrismContainer
for (assignmentValue in assignment.getValues()) {
log.info('checking {}', assignmentValue)
targetRef =
assignmentValue.asContainerable().getTargetRef()
if
(targetRef?.getOid()?.equals("98f0f92d-d4d3-465e-840e-69ef12724013"))
{ // OID is the root OU
log.info('Yes')
return true
}
log.info('No')
}
false
</code>
</script>
</condition>
</mapping>
Hope this helps,
Pavol
> Hi all,
> how to check in mapping (in template object) that user is assigned to
> selected resource?
> What is the right condition?
>
> Thanks!
> Roman Pudil
> --
>
> Roman Pudil
> solution architect
>
> gsm: [+420] 775 663 666
> e-mail: roman.pudil at ami.cz <mailto:roman.pudil at ami.cz>
>
>
>
> AMI Praha a.s.
> Pláničkova 11
> 162 00 Praha 6
> tel./fax: [+420] 274 783 239
> web: www.ami.cz <http://www.ami.cz>
>
>
>
> AMI Praha a.s.
>
>
> <http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management>
>
> Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za
> společnost AMI Praha a.s.
> jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít
> výhradně písemnou formu.
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150626/f285e08b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2900 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150626/f285e08b/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 21628 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150626/f285e08b/attachment.png>
More information about the midPoint
mailing list