create user add to vre and parent groups (feature #21866)

This commit is contained in:
Marco Lettere 2021-09-22 11:42:39 +02:00
parent f14e338e6e
commit 2674901cec
1 changed files with 2 additions and 2 deletions

View File

@ -155,7 +155,7 @@
"inputParameters": {
"tree" : "${init.output.result.tree}",
"groups" : "${look_up_groups.output.body}",
"scriptExpression": "function selectByPath(groups, path, level, acc){ for (var i=0; i < groups.length; i++) {if (groups[i].name === path[level]) {acc.push(groups[i]); if (level === path.length - 1) return acc;return selectByPath(groups[i].subGroups, path, level+1, acc)}} return []; } return { 'groups' : selectByPath($.groups, $.tree, 0, [])}"
"scriptExpression": "function selectByPath(groups, path, level, acc){ for (var i=0; i < groups.length; i++) {if (groups[i].name === path[level]) {acc.push(groups[i]); if (level === path.length - 1) return acc;return selectByPath(groups[i].subGroups, path, level+1, acc)}} return []; } return { 'groups' : Java.to(selectByPath($.groups, $.tree, 0, []),'java.util.Map[]')}"
}
},
{
@ -164,7 +164,7 @@
"type": "LAMBDA",
"inputParameters": {
"groups" : "${extract_groups.output.result.groups}",
"auth" : "${authorize.output.body.access_token",
"auth" : "${authorize.output.body.access_token}",
"kc_user_url" : "${init.input.keycloak_admin}/users/${select_user.output.result[0].id}/groups/",
"scriptExpression": "inputs={};tasks=[];for(var i=0;i<$.groups.length;i++)group=$.groups[i],tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'user_to_group_'+i}),inputs['user_to_group_'+i]={ url : $.kc_user_url + group.id, method : 'PUT', headers: { Authorization : $.auth} };return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};"
}