ApplaudSolutions / Applaud-Workato-Connector

Code pertaining to the Applaud Workato Connector
0 stars 0 forks source link

Create a user action #31

Closed karthmoh closed 2 years ago

karthmoh commented 3 years ago

Summary

  1. As a Integrations designer
  2. I want to define recipe actions that would create users
  3. so that I can automate the user provisioning

Acceptance Criteria

  1. In 'Create an instance' real-time action, I can pick the 'User' model
  2. I cannot pick the User model in the delete or bulk actions. Update/upsert - QUESTION see notes.
  3. When I pick the User model, I see some special fields for Email (required), Name (required), Initials (required), Avatar (optional), Roles (optional, multi-select), Send email invitation (required; defaults to No); and then any custom user properties
  4. When I set these the user is created in the same way as using the Invite form
  5. Notably if I send 'Send email invitation' as No the user doesn't get an email (dependent on https://github.com/ApplaudSolutions/applaud-cloud/issues/3779)

Wireframes and mockups

Create a model action with User selected

Applaud action create user

Notes

Developer Testing

Requestor: leave this section blank Developer: complete this section during commit/pull request

Positive testing:

Add all the things that you have checked whilst completing this story here, it should be written in a non-technical way, and a lot of this can probably be taken from the acceptance criteria, here are two different examples:

Negative testing:

Here you list the things you have checked where your code needs to show an error, handle unusual/bad input/config gracefully, or may impact separate features that use or depend on the same code. Pause and think -- they may not be obvious! Examples:

e2e test links and description:

duncancasemore commented 3 years ago

@karthmoh I've regroomed this.

Ritesh717 commented 3 years ago

Hi @duncancasemore , There is no option to create a record in User with APIs image We need to create a new action Invite a user to ApplaudHR which sends a mail to invite the User.

Ritesh717 commented 3 years ago

Tried to use APIs /api/users/invite to invite users, /api/role-grants to fetch all the roles in tenant. But API keys don't have access to call these APIs. Without access to these APIs we are blocked here.

duncancasemore commented 3 years ago

@GangamRitesh see here for API: https://github.com/ApplaudSolutions/applaud-cloud/issues/3779

I guess this action will need to have 2 internal API calls: 1 API call to invite and then a second to PATCH the custom user. Not sure about roles...

Ritesh717 commented 3 years ago

@duncancasemore , @lewie6 As a part of git https://github.com/ApplaudSolutions/applaud-cloud/issues/3779, role grants are added to the Users model so we have access to /api/users/invite. Currently, we don't have access to /api/role-grants. Can we include this as a part of git https://github.com/ApplaudSolutions/applaud-cloud/issues/3779 or create a new git for this.

then a second to PATCH the custom user.

When an invite is sent to the user, a user record is created in both seeded as well as custom user models. Do we need patch request?

duncancasemore commented 3 years ago

@GangamRitesh why don't we leave roles out of this story for now then. I think roles can be assigned automatically using workflow in Applaud, which is probably a better solution anyway.

I figured you'd need a PATCH on custom user to update it with the custom fields (eg, personId, countryOfWork, whatever). If you can do that in the initial invite, fine.

Ritesh717 commented 3 years ago

Sure @duncancasemore. Roles are assigned in worflow.

Similar to roles, custom user details (personId, countryOfWork, phoneNumber) are updated as part of workflows. image Can we avoid this one for now as well?

duncancasemore commented 3 years ago

@GangamRitesh happy to break it out. Do we use 'Create an instance' action and pick the model 'User' to invite (with special fields)? I think it would be neater to use the same action, then we can use 'Update an instance' action for patching a user and 'Delete an instance' to grant a user the deleted role. We'd have to think about bulk as well...

Ritesh717 commented 3 years ago

Sure @duncancasemore , will try to include in the create instance action.

Ritesh717 commented 3 years ago

@duncancasemore , Build create user instance action. Steps involved in create user action :

  1. Verify the email
  2. Invite user
  3. Search for user in custom user with input email.
  4. Update custom user record with standard(input) properties.

    Issues found in create user instance action

  5. After inviting the user, sometimes unable to find the user in the custom user model due to elastic mongo sync issues.
  6. After inviting the user, as there are workflows on the user model there is a possibility of getting an error on trying to update the custom user record(step 4) as record might be in pending state ( isInWorkflow = true),
  7. Cannot set the properties in the user model as Required to True. As properties in the user model are not set to required. image Able to set all the standard properties as required or all the properties as optional. (cannot set Email (required), Name (required), Initials (required), Avatar (optional))
  8. Cannot set these standard properties in the order shown in schema page (Order of properties is set in the order returned by cloud). image image image
Ritesh717 commented 3 years ago

Raised issues in cloud board. https://github.com/applaudsolutions/applaud-cloud/issues/3844 https://github.com/ApplaudSolutions/applaud-cloud/issues/3875 https://github.com/ApplaudSolutions/applaud-cloud/issues/3938

ssarap commented 2 years ago

This has been handled as part of Create instance action. Now we can choose User model and fill the details to send create and invite.