[midPoint] Bulk Assignment of Roles to Users via JSON API Request

Emil Militzer emil.militzer at posteo.de
Wed Jun 15 17:45:35 CEST 2022


Hi,

I think this will not work because the pipeline is not working correctly:

https://jira.evolveum.com/browse/MID-7965?orderby=updated+DESC%2C+priority+DESC

Kind regards
Emil

> Am 15.06.2022 um 15:08 schrieb Alexander Bruckner via midPoint <midpoint at lists.evolveum.com>:
> 
> 
> Hello everyone,
>  
>  
> we are currently trying to assign one role to multiple users via a JSON API request. We’ve already managed to do this over XML with this request body:
>  
> <s:pipeline xmlns:s=http://midpoint.evolveum.com/xml/ns/public/model/scripting-3
>           xmlns:c=http://midpoint.evolveum.com/xml/ns/public/common/common-3
>           xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
>           xmlns:xsd=http://www.w3.org/2001/XMLSchema
> xmlns:q=http://prism.evolveum.com/xml/ns/public/query-3>
> <s:search >
>     <s:type>c:UserType</s:type>
>     <s:searchFilter>
>        <q:inOid>
>           <q:value>c38dc04a-e780-4475-ad51-f42dd054f622</q:value>
>           <q:value>cd244459-81fe-4208-a51c-111cae039185</q:value>
>           <q:value>12d665c0-7114-4b49-97ba-94c4cd154f8a</q:value>
>        </q:inOid>
>     </s:searchFilter>
> </s:search>
> <s:sequence>
> <s:action>
>         <s:type>assign</s:type>
>         <s:parameter>
>             <s:name>role</s:name>
>             <c:value xsi:type="xsd:string">a6afcd50-5f33-4250-8b93-62cb72e1a39a</c:value>
>         </s:parameter>
>     </s:action>
>     </s:sequence>
>     </s:pipeline>
>  
> But similar approaches do not seem to work for JSON. We attempted the recommended method via heterogenous lists as outlined in https://docs.evolveum.com/midpoint/devel/design/xml-json-yaml-vs-xnode-vs-internal-data/heterogeneous-lists/:
>  
> {
>     "@ns" : http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3,
>     "pipeline": [
>         {
>             "@element": "search",
>             "type": "c:UserType",
>             "searchFilter": {
>                 "inOid": {
>                     "value": [
>                         "c38dc04a-e780-4475-ad51-f42dd054f622",
>                         "cd244459-81fe-4208-a51c-111cae039185",
>                         "12d665c0-7114-4b49-97ba-94c4cd154f8a"
>                     ]
>                 }
>             }
>         },
>         {
>             "@element": "sequence",
>             "@value": [
>                 {
>                     "@element": "action",
>                     "type": "assign",
>                     "parameter": {
>                         "type": "role",
>                         "value": "a6afcd50-5f33-4250-8b93-62cb72e1a39a"
>                     }
>                 }
>             ]
>         }
>     ]
> }
>  
> But received the error message:
>  
> <message>Wrong input value for ExecuteScriptType: RawType: (raw): XNode(list:2 elements))</message>
>     <details>java.lang.IllegalArgumentException: Wrong input value for ExecuteScriptType: RawType: (raw): XNode(list:2 elements))
>  
> It seems like Pipeline is not expecting a list of objects.
> Is there some error in our current JSON or is there a different way of writing the query?
>  
> If anyone of you has some advice regarding this, it would be greatly appreciated!
>  
>  
> Thank you and best regards,
> Alexander Bruckner
>  
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220615/fb72a17a/attachment-0001.htm>


More information about the midPoint mailing list