refactored to use exact and briefRepresentation for users

This commit is contained in:
Marco Lettere 2024-05-30 21:40:53 +02:00
parent 4da946f250
commit 1bc11702a5
2 changed files with 5 additions and 16 deletions

View File

@ -2,12 +2,12 @@
workflows:
# - create-user-add-to-vre
# - group_deleted
# - user-group_created
- user-group_created
# - user-group-role_created
# - group_created
# - invitation-accepted
# - user-group_deleted
- user-group-role_deleted
# - user-group-role_deleted
# - delete-user-account
# - keycloak_delete_account
# - role_deleted

View File

@ -42,7 +42,7 @@
"taskReferenceName" : "lookup_user",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/users?username=${workflow.input.user}",
"url" : "${init.input.keycloak_admin}/users?username=${workflow.input.user}&exact=true&briefRepresentation=true",
"method" : "GET",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
@ -50,22 +50,11 @@
}
}
},
{
"name": "INLINE_TASK",
"taskReferenceName": "select_user",
"inputParameters": {
"foundusers": "${lookup_user.output.body}",
"username": "${workflow.input.user}",
"evaluatorType" : "javascript",
"expression": "function f(){for(var i=0; i < $.foundusers.length;i++){if($.foundusers[i]['username'] == $.username) return $.foundusers[i]}} f()"
},
"type": "INLINE"
},
{
"name": "check_user_existance",
"taskReferenceName": "check_user_existance",
"inputParameters": {
"user": "${select_user.output.result}"
"user": "${lookup_user.output.body[0]}"
},
"type": "SWITCH",
"evaluatorType" : "javascript",
@ -122,7 +111,7 @@
"taskReferenceName" : "assign_user_to_group",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/users/${select_user.output.result.id}/groups/${extract_group.output.result.group.id}",
"url" : "${init.input.keycloak_admin}/users/${lookup_user.output.body[0].id}/groups/${extract_group.output.result.group.id}",
"method" : "PUT",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}"