create group directly under parent
This commit is contained in:
parent
72d4ba9799
commit
51be38cd57
|
@ -309,22 +309,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "create_kc_group",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups",
|
||||
"body" : {
|
||||
"name" : "${init.output.result.child}"
|
||||
},
|
||||
"method" : "POST",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Content-Type" : "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "list_kc_groups",
|
||||
|
@ -343,11 +327,9 @@
|
|||
"taskReferenceName": "prepare",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"append" : "${init.output.result.append}",
|
||||
"location" : "${create_kc_group.output.headers.location}",
|
||||
"client_location" : "${create_client.output.headers.location}",
|
||||
"groups" : "${list_kc_groups.output.body}",
|
||||
"scriptExpression": "var newid=$.location.split('/').pop(); var client_id = $.client_location.split('/').pop(); function recurse(inp){for(var i=0;i<inp.length;i++){if(inp[i]['path'] === $.append) return inp[i]; else{var subr = recurse(inp[i].subGroups); if(subr != null) return subr;}} return null}; return {'group' : $.append == '' ? '' : recurse($.groups), 'newid' : newid, 'client_id' : client_id}"
|
||||
"append": "${init.output.result.append}",
|
||||
"groups": "${list_kc_groups.output.body}",
|
||||
"scriptExpression": "function recurse(inp){for(var i=0;i<inp.length;i++){if(inp[i]['path'] === $.append) return inp[i]; else{var subr = recurse(inp[i].subGroups); if(subr != null) return subr;}} return null}; return {'group' : $.append == '' ? '' : recurse($.groups)}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -372,16 +354,40 @@
|
|||
},
|
||||
"defaultCase": [
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "move_new_kc_group_to_parent",
|
||||
"name": "pyrest",
|
||||
"taskReferenceName": "create_kc_group",
|
||||
"inputParameters": {
|
||||
"url": "${init.input.keycloak_admin}/groups/${prepare.output.result.group.id}/children",
|
||||
"body": {
|
||||
"name": "${init.output.result.child}"
|
||||
},
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Authorization": "Bearer ${authorize.output.body.access_token}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
},
|
||||
"type": "SIMPLE"
|
||||
},
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "prepare2",
|
||||
"inputParameters": {
|
||||
"location": "${create_kc_group.output.headers.location}",
|
||||
"client_location": "${create_client.output.headers.location}",
|
||||
|
||||
"scriptExpression": "var newid=$.location.split('/').pop(); var client_id = $.client_location.split('/').pop(); return {'newid' : newid, 'client_id' : client_id}"
|
||||
},
|
||||
"type": "LAMBDA"
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "assign_client_member_role_to_kc_group",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups/${prepare.output.result.group.id}/children",
|
||||
"url" : "${init.input.keycloak_admin}/groups/${prepare2.output.result.newid}/role-mappings/clients/${prepare2.output.result.client_id}",
|
||||
"method" : "POST",
|
||||
"body" : {
|
||||
"id" : "${prepare.output.result.newid}",
|
||||
"name": "${init.output.result.child}"
|
||||
},
|
||||
"body" : ["${get_back_role_member.output.body}"],
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Accept" : "application/json",
|
||||
|
@ -390,21 +396,6 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "assign_client_member_role_to_kc_group",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups/${prepare.output.result.newid}/role-mappings/clients/${prepare.output.result.client_id}",
|
||||
"method" : "POST",
|
||||
"body" : ["${get_back_role_member.output.body}"],
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Accept" : "application/json",
|
||||
"Content-Type" : "application/json"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -492,7 +483,7 @@
|
|||
"type" : "JOIN",
|
||||
"joinOn" : [
|
||||
"join_parallel_policy_addition",
|
||||
"assign_client_member_role_to_kc_group"
|
||||
"decide1"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue