fixed script for permission addition

This commit is contained in:
dcore94 2021-03-23 17:40:53 +01:00
parent 98539d1a71
commit b2faf6497a
1 changed files with 3 additions and 3 deletions

View File

@ -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[]')"
}
},
{