From 51e3d8599ccb6f859c154467eac45462f0f5fbef Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 23 Mar 2021 16:59:10 +0100 Subject: [PATCH] fixed script for policy addition --- templates/group_created.json.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/group_created.json.j2 b/templates/group_created.json.j2 index 0ef7ea8..64aa95c 100644 --- a/templates/group_created.json.j2 +++ b/templates/group_created.json.j2 @@ -402,8 +402,8 @@ "taskReferenceName": "build_add_policy_tasks", "type": "LAMBDA", "inputParameters": { - "roles" : "${join_parallel_role_addition.output[*]}", - "scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.roles.length;i++)r=$.roles[i],k='add-'+r.name,tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'create_role_policy_'+k}),inputs['create_role_policy_'+k]={url:'${init.input.keycloak_admin}/clients/${extract_client_id.output.result.client_id}/authz/resource-server/policy/role',body:{name:r.name+'_policy',description:'',type:'role',logic:'POSITIVE',decisionStrategy:'UNANIMOUS',roles:Java.to([{id:r.id,required:true}], 'java.util.Map[]')},method:'POST',headers:{Authorization:'Bearer ${authorize.output.body.access_token}',Accept:'application/json'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" + "roles" : "${join_parallel_role_addition.output[*].body}", + "scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.roles.length;i++)r=$.roles[i],k='add-'+r.name,tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'create_role_policy_'+k}),inputs['create_role_policy_'+k]={url:'${init.input.keycloak_admin}/clients/${extract_client_id.output.result.client_id}/authz/resource-server/policy/role',body:{name:r.name+'_policy',description:'',type:'role',logic:'POSITIVE',decisionStrategy:'UNANIMOUS',roles:Java.to([{id:r.id,required:true}], 'java.util.Map[]')},method:'POST',headers:{Authorization:'Bearer ${authorize.output.body.access_token}',Content-Type:'application/json'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" } }, {