modernize delete-user-account

This commit is contained in:
Marco Lettere 2023-10-12 18:19:14 +02:00
parent 35ce4dc32e
commit e648baf5bd
2 changed files with 18 additions and 16 deletions

View File

@ -1,6 +1,6 @@
--- ---
workflows: workflows:
- create-user-add-to-vre # - create-user-add-to-vre
# - group_deleted # - group_deleted
# - user-group_created # - user-group_created
# - user-group-role_created # - user-group-role_created
@ -8,7 +8,7 @@ workflows:
# - invitation-accepted # - invitation-accepted
# - user-group_deleted # - user-group_deleted
# - user-group-role_deleted # - user-group-role_deleted
# - delete-user-account - delete-user-account
# - role_deleted # - role_deleted
# - role_created # - role_created
# - add_role_policy_permission # - add_role_policy_permission

View File

@ -8,17 +8,18 @@
"inputParameters" : [ "userid" ], "inputParameters" : [ "userid" ],
"tasks" : [ "tasks" : [
{ {
"name": "LAMBDA_TASK", "name": "INLINE_TASK",
"taskReferenceName": "init", "taskReferenceName": "init",
"type": "LAMBDA", "type": "INLINE",
"inputParameters": { "inputParameters": {
"root_vo": "{{ root_vo }}", "root_vo": "{{ root_vo }}",
"keycloak": "{{ keycloak }}/${workflow.input.realm}", "keycloak": "{{ keycloak }}/${workflow.input.realm}",
"keycloak_admin" : "{{ keycloak_admin }}/${workflow.input.realm}", "keycloak_admin" : "{{ keycloak_admin }}/${workflow.input.realm}",
"liferay": "{{ liferay }}", "liferay": "{{ liferay }}",
"liferay_auth": "{{ liferay_auth }}", "liferay_auth": "{{ liferay_auth }}",
"keycloak_userid" : "${workflow.input.userid}", "keycloak_userid" : "${workflow.input.userid}",
"scriptExpression": "return { 'decoded_root_vo' : $.root_vo.replace('%2F','/'), 'encoded_root_vo' : encodeURIComponent($.root_vo)}" "evluatorType" : "javascript",
"expression": "function f(){ return { 'decoded_root_vo' : $.root_vo.replace('%2F','/'), 'encoded_root_vo' : encodeURIComponent($.root_vo)}} f()"
} }
}, },
{ {
@ -107,13 +108,14 @@
} }
}, },
{ {
"name": "LAMBDA_TASK", "name": "INLINE_TASK",
"taskReferenceName": "build_delete_group_tasks", "taskReferenceName": "build_delete_group_tasks",
"type": "LAMBDA", "type": "INLINE",
"inputParameters": { "inputParameters": {
"evaluatorType" : "javascript",
"groups" : "${lookup_lr_user_groups.output.body.*.groupId}", "groups" : "${lookup_lr_user_groups.output.body.*.groupId}",
"userId" : "${lookup_lr_user_by_screenname.output.body.userId}", "userId" : "${lookup_lr_user_by_screenname.output.body.userId}",
"scriptExpression": "inputs = {}; tasks = []; for(var i=0;i<$.groups.length;i++){tasks.push({'name': 'pyrest','type' : 'SIMPLE','taskReferenceName' : 'del-' + i});inputs['del-'+i] = {'url' : '${init.input.liferay}/user/unset-group-users?userIds=' + $.userId + '&groupId=' + $.groups[i],'method' : 'POST','headers' : {'Authorization' : 'Basic ' + '${init.input.liferay_auth}', 'Accept' : 'application/json'}}}; return { 'tasks' : Java.to(tasks, 'java.util.Map[]'), 'inputs' : inputs};" "expression": "inputs = {}; tasks = []; function f(){ for(var i=0;i<$.groups.length;i++){tasks.push({'name': 'pyrest','type' : 'SIMPLE','taskReferenceName' : 'del-' + i});inputs['del-'+i] = {'url' : '${init.input.liferay}/user/unset-group-users?userIds=' + $.userId + '&groupId=' + $.groups[i],'method' : 'POST','headers' : {'Authorization' : 'Basic ' + '${init.input.liferay_auth}', 'Accept' : 'application/json'}}}; return { 'tasks' : Java.to(tasks, 'java.util.Map[]'), 'inputs' : inputs}} f()"
} }
}, },
{ {
@ -149,9 +151,9 @@
} }
}, },
{ {
"name": "LAMBDA_TASK", "name": "INLINE_TASK",
"taskReferenceName": "lr_final_task", "taskReferenceName": "lr_final_task",
"type": "LAMBDA", "type": "INLINE",
"inputParameters" : { "inputParameters" : {
"scriptExpression" : "1 == 1" "scriptExpression" : "1 == 1"
} }