fixed missing append on root group, assign role to user is tolerant to non existing roles
This commit is contained in:
parent
81f17861e0
commit
74d400fa9d
|
@ -145,25 +145,48 @@
|
||||||
"location" : "${create_kc_group.output.headers.location}",
|
"location" : "${create_kc_group.output.headers.location}",
|
||||||
"client_location" : "${create_client.output.headers.location}",
|
"client_location" : "${create_client.output.headers.location}",
|
||||||
"groups" : "${list_kc_groups.output.body}",
|
"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{'group' : inp[i], 'newid' : newid, 'client_id' : client_id}; else{var subr = recurse(inp[i].subGroups); if(subr != null) return {'group' : subr, 'newid' : newid, 'client_id' : client_id};}} return null}; return recurse($.groups)"
|
"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}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name" : "pyrest",
|
"name": "decide_task",
|
||||||
"taskReferenceName" : "move_new_kc_group_to_parent",
|
"taskReferenceName": "decide1",
|
||||||
"type" : "SIMPLE",
|
"inputParameters": {
|
||||||
"inputParameters" : {
|
"groupid": "${prepare.output.result.group}"
|
||||||
"url" : "${init.input.keycloak_admin}/groups/${prepare.output.result.group.id}/children",
|
},
|
||||||
"method" : "POST",
|
"type": "DECISION",
|
||||||
"body" : {
|
"caseValueParam": "groupid",
|
||||||
"id" : "${prepare.output.result.newid}"
|
"decisionCases": {
|
||||||
},
|
"": [
|
||||||
"headers" : {
|
{
|
||||||
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
"name": "LAMBDA_TASK",
|
||||||
"Accept" : "application/json",
|
"taskReferenceName": "dummy",
|
||||||
"Content-Type" : "application/json"
|
"type": "LAMBDA",
|
||||||
|
"inputParameters": {
|
||||||
|
"scriptExpression": "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"defaultCase": [
|
||||||
|
{
|
||||||
|
"name" : "pyrest",
|
||||||
|
"taskReferenceName" : "move_new_kc_group_to_parent",
|
||||||
|
"type" : "SIMPLE",
|
||||||
|
"inputParameters" : {
|
||||||
|
"url" : "${init.input.keycloak_admin}/groups/${prepare.output.result.group.id}/children",
|
||||||
|
"method" : "POST",
|
||||||
|
"body" : {
|
||||||
|
"id" : "${prepare.output.result.newid}"
|
||||||
|
},
|
||||||
|
"headers" : {
|
||||||
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||||
|
"Accept" : "application/json",
|
||||||
|
"Content-Type" : "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name" : "pyrest",
|
"name" : "pyrest",
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
"type" : "SIMPLE",
|
"type" : "SIMPLE",
|
||||||
"inputParameters" : {
|
"inputParameters" : {
|
||||||
"url" : "${init.input.keycloak_admin}/users/${lookup_user.output.body[0].id}/role-mappings/clients/${lookup_client.output.body[0].id}",
|
"url" : "${init.input.keycloak_admin}/users/${lookup_user.output.body[0].id}/role-mappings/clients/${lookup_client.output.body[0].id}",
|
||||||
"expect" : 204,
|
"expect" : [204, 404],
|
||||||
"method" : "POST",
|
"method" : "POST",
|
||||||
"body" : "${select_role.output.result}",
|
"body" : "${select_role.output.result}",
|
||||||
"headers" : {
|
"headers" : {
|
||||||
|
|
Loading…
Reference in New Issue