From c8e64192c1898c2a746dba1b0e57fca6200b754e Mon Sep 17 00:00:00 2001 From: dcore94 Date: Wed, 7 Oct 2020 12:27:17 +0200 Subject: [PATCH] changed code for invitation workflow which was wrong --- .../workflows/portal/invitation-accepted.json | 78 ++++++++++++++++--- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/resources/workflows/portal/invitation-accepted.json b/resources/workflows/portal/invitation-accepted.json index 4541cb4..41f3864 100644 --- a/resources/workflows/portal/invitation-accepted.json +++ b/resources/workflows/portal/invitation-accepted.json @@ -1,14 +1,68 @@ { - "model-class-name": "com.liferay.portal.model.Group", - "sender": "gcube", - "name": "invitation-accepted", - "type": "portal", - "uuid": "73de5431-3920-4dc2-b00d-70a976891f7d", - "timestamp" : "2020-07-24T12:09:24.585Z", - "user": "gino.stilla", - "password" : "123456", - "first-name" : "Gino", - "last-name" : "Stilla", - "email" : "gino@stilla.com" + "ownerApp" : "Orchestrator", + "name" : "invitation-accepted", + "createBy" : "Mauro Mugnaini", + "description": "Handle workflow related to Portal event invitation-accepted", + "version" : 1, + "ownerEmail" : "mauro.mugnaini@nubisware.com", + "inputParameters" : ["user", "first-name", "last-name", "email", "password"], + "tasks" : [ + { + "name": "LAMBDA_TASK", + "taskReferenceName": "init", + "type": "LAMBDA", + "inputParameters": { + "keycloak": "https://accounts.dev.d4science.org/auth/realms/d4science", + "keycloak_admin" : "https://accounts.dev.d4science.org/auth/admin/realms/d4science", + "scriptExpression": "1" + } + }, + { + "name" : "pyrest", + "taskReferenceName" : "authorize", + "type" : "SIMPLE", + "inputParameters" : { + "url" : "${init.input.keycloak}/protocol/openid-connect/token", + "method" : "POST", + "headers" : { + "Accept" : "application/json" + }, + "body" : { + "client_id" : "orchestrator", + "client_secret" : "c93501bd-abeb-4228-bc28-afac38877338", + "grant_type" : "client_credentials" + } + } + }, + { + "name" : "pyrest", + "taskReferenceName" : "create_user", + "type" : "SIMPLE", + "inputParameters" : { + "url" : "${init.input.keycloak_admin}/users", + "expect" : 201, + "method" : "POST", + "body" : { + "username": "${workflow.input.user}", + "firstName": "${workflow.input.first-name}", + "lastName": "${workflow.input.last-name}", + "email": "${workflow.input.email}", + "credentials": [ + { + "temporary": true, + "type": "password", + "value": "${workflow.input.password}" + } + ], + "requiredActions": ["UPDATE_PASSWORD"], + "emailVerified": true, + "enabled": true + }, + "headers" : { + "Authorization" : "Bearer ${authorize.output.body.access_token}", + "Content-Type" : "application/json" + } + } + } + ] } -