anticipated group creation even more
This commit is contained in:
parent
5d6a17d2f5
commit
6f94ff6125
|
@ -114,7 +114,80 @@
|
|||
"scriptExpression": "var client_id = $.client_location.split('/').pop(); return {'client_id' : client_id}"
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "list_kc_groups",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups",
|
||||
"method" : "GET",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Accept" : "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "prepare",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"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)}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "decide_task",
|
||||
"taskReferenceName": "decide1",
|
||||
"inputParameters": {
|
||||
"groupid": "${prepare.output.result.group}"
|
||||
},
|
||||
"type": "DECISION",
|
||||
"caseValueParam": "groupid",
|
||||
"decisionCases": {
|
||||
"": [
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "dummy",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"scriptExpression": "1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"defaultCase": [
|
||||
{
|
||||
"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" : "get_default_policies",
|
||||
"type" : "SIMPLE",
|
||||
|
@ -225,6 +298,23 @@
|
|||
"taskReferenceName" : "preliminary_fork_join",
|
||||
"joinOn": [ "create_permission", "get_rootvo_roles"]
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "authorize1",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "{{ keycloak }}/master/protocol/openid-connect/token",
|
||||
"method" : "POST",
|
||||
"headers" : {
|
||||
"Accept" : "application/json"
|
||||
},
|
||||
"body" : {
|
||||
"client_id" : "orchestrator",
|
||||
"client_secret" : "{{ keycloak_auth_master }}",
|
||||
"grant_type" : "client_credentials"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "create_role_member",
|
||||
|
@ -236,7 +326,7 @@
|
|||
},
|
||||
"method" : "POST",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Authorization" : "Bearer ${authorize1.output.body.access_token}",
|
||||
"Content-Type" : "application/json"
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +339,7 @@
|
|||
"url" : "${create_role_member.output.headers.location}",
|
||||
"method" : "GET",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Authorization" : "Bearer ${authorize1.output.body.access_token}",
|
||||
"Accept" : "application/json"
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +361,7 @@
|
|||
"url" : "${init.input.keycloak_admin}/roles/Infrastructure-Member/composites",
|
||||
"method" : "POST",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Authorization" : "Bearer ${authorize1.output.body.access_token}",
|
||||
"Content-Type" : "application/json"
|
||||
},
|
||||
"body" : "${to_array.output.resultList}"
|
||||
|
@ -298,35 +388,12 @@
|
|||
},
|
||||
"method" : "POST",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Authorization" : "Bearer ${authorize1.output.body.access_token}",
|
||||
"Content-Type" : "application/json",
|
||||
"Accept" : "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "list_kc_groups",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups",
|
||||
"method" : "GET",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Accept" : "application/json"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "prepare",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"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)}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "decide_task",
|
||||
"taskReferenceName": "decide1",
|
||||
|
@ -348,33 +415,6 @@
|
|||
]
|
||||
},
|
||||
"defaultCase": [
|
||||
{
|
||||
"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",
|
||||
|
@ -384,7 +424,7 @@
|
|||
"method" : "POST",
|
||||
"body" : ["${get_back_role_member.output.body}"],
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||
"Authorization" : "Bearer ${authorize1.output.body.access_token}",
|
||||
"Accept" : "application/json",
|
||||
"Content-Type" : "application/json"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue