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",
|
"name" : "pyrest",
|
||||||
"taskReferenceName" : "list_kc_groups",
|
"taskReferenceName" : "list_kc_groups",
|
||||||
|
@ -343,11 +327,9 @@
|
||||||
"taskReferenceName": "prepare",
|
"taskReferenceName": "prepare",
|
||||||
"type": "LAMBDA",
|
"type": "LAMBDA",
|
||||||
"inputParameters": {
|
"inputParameters": {
|
||||||
"append" : "${init.output.result.append}",
|
"append": "${init.output.result.append}",
|
||||||
"location" : "${create_kc_group.output.headers.location}",
|
"groups": "${list_kc_groups.output.body}",
|
||||||
"client_location" : "${create_client.output.headers.location}",
|
"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)}"
|
||||||
"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}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -372,16 +354,40 @@
|
||||||
},
|
},
|
||||||
"defaultCase": [
|
"defaultCase": [
|
||||||
{
|
{
|
||||||
"name" : "pyrest",
|
"name": "pyrest",
|
||||||
"taskReferenceName" : "move_new_kc_group_to_parent",
|
"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",
|
"type" : "SIMPLE",
|
||||||
"inputParameters" : {
|
"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",
|
"method" : "POST",
|
||||||
"body" : {
|
"body" : ["${get_back_role_member.output.body}"],
|
||||||
"id" : "${prepare.output.result.newid}",
|
|
||||||
"name": "${init.output.result.child}"
|
|
||||||
},
|
|
||||||
"headers" : {
|
"headers" : {
|
||||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||||
"Accept" : "application/json",
|
"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",
|
"type" : "JOIN",
|
||||||
"joinOn" : [
|
"joinOn" : [
|
||||||
"join_parallel_policy_addition",
|
"join_parallel_policy_addition",
|
||||||
"assign_client_member_role_to_kc_group"
|
"decide1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue