unee-t / enterprise-rest-api

RestFUL API on Unee-T enterprise
https://eapi.dev.unee-t.com/
0 stars 1 forks source link

API to create a new user #2

Open franck-boullier opened 5 years ago

franck-boullier commented 5 years ago

How it should work:

Input:

Output:

Success:

Returns:

Keep in mind that the same user can be associated to several different API keys giving him/her access to different units.

Example:

Step 1

A user user@example.com is created in Unee-T by a user enterprise_A@example.com.

The user enterprise_A@example.com will need to grant access to several units in his organization:

The user user@example.com has:

User enterprise_A@example.com can only see the API key apikey_A associated to user@example.com. User enterprise_A@example.com can use the API key apikey_A to allow access to Unee-T via a 3rd party app created by Enterpirse A.

Step 2

Another user enterprise_B@example.com "creates" the same user user@example.com in Unee-T.

The user enterprise_B@example.com will need to grant access to several units in his organization:

The user user@example.com has:

User enterprise_B@example.com can only see the API key apikey_B associated to user@example.com. User enterprise_B@example.com can use the API key apikey_B to allow access to Unee-T via a 3rd party app created by Enterpirse B.

Failure:

Include descriptive error message.

What happens in the back end:

kaihendry commented 5 years ago

wrt returns for #2, #3, #4, #5, #6, #7, we cannot respond whether the set data has been successfully invoked/setup on MEFE et al.

We can respond basically that the data has been written to the table successfully or not. That's it.

As for responding with "MEFE API Key associated to this users and user creator." or "Return timestamp: date and time (Z) when the user was successfully added to the unit.", we can't do that.

Another "check my request API" needs to be documented, where the client has to poll to work out how their set data has been applied. That "check my request API" is how @franck-boullier currently checks his relevant (logging) tables to know whether our asynchronous jobs were successful or not, or yet to be run.

kaihendry commented 5 years ago

for e.g. next steps here is how to query that given that a new user has been created in the relevant table (what table is this btw?), demonstrate how to find "MEFE API Key associated to this users and user creator.". I.e. what is the SQL query to know that this new user has been created.

franck-boullier commented 5 years ago

How the user creation works in UNTE:

UNTE master user insert the user information about user that needs to be created. As part of this process we will have the following information:

After the user creation request is sent to the UNTE:

In the UNTE database the tables that matter is the table ut_map_external_source_users The query you need is

SELECT 
  `unee_t_mefe_user_id`
  , `unee_t_mefe_user_api_key`
  , `uneet_created_datetime`
  , `is_mefe_api_success`
  , `mefe_api_error_message`
FROM `ut_map_external_source_users`
WHERE `external_person_id` = "[external_person_id]"
  AND `external_system` = "[external_system]"
  AND `table_in_external_system` = "[table_in_external_system]"
  AND `organization_id` = "[organization_id]"
;

This will return a single record where:

kaihendry commented 5 years ago

Is organization_id the same as organization_key or is it different?

I'm not clear what table the created user data goes into. persons or external_persons ? table_in_external_system is not in the persons table for e.g.

I don't quite understand "After the user creation request is sent to the UNTE". Is that to give info on the request like https://github.com/unee-t/enterprise-rest-api/issues/10 ?