From b2faf6497aa9c416feea4ca8d002b63d2e79f57d Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 23 Mar 2021 17:40:53 +0100 Subject: [PATCH] fixed script for permission addition --- templates/group_created.json.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/group_created.json.j2 b/templates/group_created.json.j2 index 0faa61d..abc4f81 100644 --- a/templates/group_created.json.j2 +++ b/templates/group_created.json.j2 @@ -403,7 +403,7 @@ "type": "LAMBDA", "inputParameters": { "roles" : "${join_parallel_getting_back.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};" + "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', 'Content-Type':'application/json'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" } }, { @@ -440,8 +440,8 @@ "type": "LAMBDA", "inputParameters": { "memberpolicy" : "${create_role_policy_member.output.body.id}", - "otherpolicies" : "${join_role_creation.output.body.id}", - "scriptExpression": "return Java.to($.memberpolicy.concat($.otherpolicies),'java.lang.String[]')" + "otherpolicies" : "${join_parallel_policy_addition.output.body.id}", + "scriptExpression": "return Java.to([$.memberpolicy].concat($.otherpolicies),'java.lang.String[]')" } }, {