forked from m.lettere/orchestrator-setup
update group_deleted workflow to remove also keycloak group
This commit is contained in:
parent
f8d1a33a74
commit
81f17861e0
|
@ -3,18 +3,19 @@
|
|||
"name" : "group_deleted",
|
||||
"createBy" : "Marco Lettere",
|
||||
"description": "Handle workflow related to Portal event group_created",
|
||||
"version" : 1,
|
||||
"ownerEmail" : "marco.lettere@nubisware.com",
|
||||
"version" : 2,
|
||||
"ownerEmail" : "m.lettere@gmail.com",
|
||||
"inputParameters" : ["user", "group"],
|
||||
"tasks" : [
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "init",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"keycloak": "https://accounts.dev.d4science.org/auth/realms/d4science",
|
||||
"keycloak_admin" : "https://accounts.dev.d4science.org/auth/admin/realms/d4science",
|
||||
"scriptExpression" : "1"
|
||||
{
|
||||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "init",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"keycloak": "https://accounts.dev.d4science.org/auth/realms/d4science",
|
||||
"keycloak_admin" : "https://accounts.dev.d4science.org/auth/admin/realms/d4science",
|
||||
"group" : "${workflow.input.group}",
|
||||
"scriptExpression" : "return $.group.split('%2F').join('/')"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -59,6 +60,41 @@
|
|||
"Authorization" : "Bearer ${authorize.output.body.access_token}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"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": "find_group_by_path",
|
||||
"type": "LAMBDA",
|
||||
"inputParameters": {
|
||||
"path" : "${init.output.result}",
|
||||
"groups" : "${list_kc_groups.output.body}",
|
||||
"scriptExpression": "function recurse(inp){for(var i=0;i<inp.length;i++){if(inp[i]['path'] === $.path) return inp[i]; else{var subr = recurse(inp[i].subGroups); if(subr != null) return subr;}} return null}; return recurse($.groups)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "pyrest",
|
||||
"taskReferenceName" : "delete_group",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"url" : "${init.input.keycloak_admin}/groups/${find_group_by_path.output.result.id}",
|
||||
"method" : "DELETE",
|
||||
"headers" : {
|
||||
"Authorization" : "Bearer ${authorize.output.body.access_token}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue