phac-nml / irida-next

IRIDA Next
https://phac-nml.github.io/irida-next/
Apache License 2.0
8 stars 2 forks source link

Bot accounts model service setup #523

Closed deepsidhu85 closed 3 months ago

deepsidhu85 commented 3 months ago

What does this PR do and why?

Describe in detail what your merge request does and why.

This PR adds in the db, model, and service layer for namespace bot accounts.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a new account for IRIDA next from the UI, login, and create a project
  2. Open rails console in the terminal
  3. Set the following user = User.last, proj_namespace = Namespaces::ProjectNamespace.last, params = {"token_name": "Uploader", "scopes":["read_api", "api"], "access_level":20}
  4. Run Bots::CreateService.new(user, proj_namespace, params).execute
  5. Verify that a new user was created with a user_type of 1 which is a project_bot
  6. Verify that the user is linked to the namespace via NamespaceBot
  7. Set the last NamespaceBot to a variable
  8. Run `Bots::DestroyService.new(VARIABLE_FROM_STEP_7, proj_namespace, user)
  9. Verify that the NamespaceBot was destroyed and the underlying user from the users table. Also verify that the namespace is not deleted.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

github-actions[bot] commented 3 months ago

Simplecov Report

Covered Threshold
91.89% 90%