unee-t / lambda2sqs

Relays SQL triggered payloads to MEFE via a queue
https://ap-southeast-1.console.aws.amazon.com/lambda/home?region=ap-southeast-1#/applications/lambda2sqs
GNU Affero General Public License v3.0
0 stars 4 forks source link

MEFE API - Remove a user from a role in a unit #14

Closed franck-boullier closed 5 years ago

franck-boullier commented 5 years ago

This describes the MEFE API to remove a user from a role in a Unee-T unit. This API is also needed to reset the user permission for a given user in a given unit https://github.com/unee-t/frontend/pull/742 for more details.

The Payload needed by the MEFE API:

{
    "actionType": "DEASSIGN_ROLE",
    "requestorUserId": "R4vBD6BZRCNx8JwnM",
    "userId": "2HPpT3FYjQ2PacskN",
    "unitId": "FuFMO1O1ISXPmwtMB"
}

Example response:

{
    "timestamp": "2019-03-29T11:50:47.801Z"
}

The Payload generated by the SQL via Lambda:

{
    "removeUserFromUnitRequestId": 1,
    "actionType": "DEASSIGN_ROLE",
    "requestorUserId": "R4vBD6BZRCNx8JwnM",
    "userId": "2HPpT3FYjQ2PacskN",
    "unitId": "FuFMO1O1ISXPmwtMB"
}

The SQL to run after the API returns a success:

SET @remove_user_from_unit_request_id = `removeUserFromUnitRequestId` ;
SET @updated_datetime = `timestamp` ;  [(the SQL formatted timestamp of the reply from the MEFE API)]
CALL `ut_update_success_remove_user_from_unit`;

@kaihendry Let me know when all is ready on your side (Golang) so I can test end to end.

kaihendry commented 5 years ago

Getting "Response code 400, Body: \"Unrecognized actionType DEASSIGN_ROLE\" from MEFE.

Guess it needs https://github.com/unee-t/frontend/pull/742 to implemented @nbiton

franck-boullier commented 5 years ago

Not fully tested - reopening this