2021-03-24 15:40:52 +01:00
|
|
|
{
|
|
|
|
"ownerApp" : "Orchestrator",
|
|
|
|
"name" : "role_deleted",
|
|
|
|
"createBy" : "Marco Lettere",
|
|
|
|
"description": "Handle workflow related to Portal event role_deleted",
|
|
|
|
"version" : 1,
|
|
|
|
"ownerEmail" : "marco.lettere@nubisware.com",
|
|
|
|
"inputParameters" : ["role"],
|
|
|
|
"tasks" : [
|
|
|
|
{
|
2023-10-12 16:43:37 +02:00
|
|
|
"name": "INLINE_TASK",
|
2021-03-24 15:40:52 +01:00
|
|
|
"taskReferenceName": "init",
|
2023-10-12 16:43:37 +02:00
|
|
|
"type": "INLINE",
|
2021-03-24 15:40:52 +01:00
|
|
|
"inputParameters": {
|
|
|
|
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
|
|
|
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
2023-10-12 16:43:37 +02:00
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
"expression": "1 == 1"
|
2021-03-24 15:40:52 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name" : "pyrest",
|
|
|
|
"taskReferenceName" : "authorize",
|
|
|
|
"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" : "get_all_vres",
|
|
|
|
"type" : "SIMPLE",
|
|
|
|
"inputParameters" : {
|
|
|
|
"url" : "${init.input.keycloak_admin}/clients?clientId=%252F&search=true&first=0&max=500",
|
|
|
|
"method" : "GET",
|
|
|
|
"headers" : {
|
|
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
|
|
"Accept" : "application/json"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2023-10-12 17:02:35 +02:00
|
|
|
"name": "INLINE_TASK",
|
2021-03-24 15:40:52 +01:00
|
|
|
"taskReferenceName": "build_delete_role_tasks",
|
2023-10-12 17:02:35 +02:00
|
|
|
"type": "INLINE",
|
2021-03-24 15:40:52 +01:00
|
|
|
"inputParameters": {
|
|
|
|
"role" : "${workflow.input.role}",
|
|
|
|
"vres" : "${get_all_vres.output.body}",
|
2023-10-12 16:43:37 +02:00
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
"expression": "inputs={};tasks=[];function f(){for(var i=0;i<$.vres.length;i++)vre=$.vres[i],tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'delete_role_'+i}),inputs['delete_role_'+i]={url:'${init.input.keycloak_admin}/clients/' + vre.id + '/roles/' + $.role,method:'DELETE', expect:Java.to([204,404],'int[]'),headers:{Authorization:'Bearer ${authorize.output.body.access_token}'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs}} f();"
|
2021-03-24 15:40:52 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name" : "fork_dynamic",
|
|
|
|
"type" : "FORK_JOIN_DYNAMIC",
|
|
|
|
"taskReferenceName" : "parallel_delete_role",
|
|
|
|
"inputParameters" : {
|
|
|
|
"tasks" : "${build_delete_role_tasks.output.result.tasks}",
|
|
|
|
"inputs" : "${build_delete_role_tasks.output.result.inputs}"
|
|
|
|
},
|
|
|
|
"dynamicForkTasksParam": "tasks",
|
|
|
|
"dynamicForkTasksInputParamName": "inputs"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name" : "join",
|
|
|
|
"type" : "JOIN",
|
|
|
|
"taskReferenceName" : "join_parallel_role_deletion"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|