Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke CreateProject from Tenant #161

Merged
merged 5 commits into from Feb 3, 2023
Merged

Invoke CreateProject from Tenant #161

merged 5 commits into from Feb 3, 2023

Conversation

pdeziel
Copy link
Contributor

@pdeziel pdeziel commented Feb 3, 2023

Scope of changes

This completes the project security checks on the Tenant side by telling Quarterdeck to create the organization-project link when the user creates a project. This ensures that users will be able to edit api keys only in their organization since Quarterdeck can check to make sure that the organization-project mapping already exists.

Fixes SC-13122

Type of change

  • new feature
  • bug fix
  • documentation
  • testing
  • technical debt
  • security

Acceptance criteria

Describe how reviewers can test this change to be sure that it works correctly. Add a checklist if possible.

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have updated the dependencies list
  • I have recompiled and included new protocol buffers to reflect changes I made
  • I have added new test fixtures as needed to support added tests
  • Check this box if a reviewer can merge this pull request after approval (leave it unchecked if you want to do it yourself)
  • I have moved the associated Shortcut story to "Ready for Review"

Reviewer(s) checklist

  • Any new user-facing content that has been added for this PR has been QA'ed to ensure correct grammar, spelling, and understandability.
  • Are there any TODOs in this PR that should be turned into stories?

@shortcut-integration
Copy link

Copy link
Contributor

@bbengfort bbengfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

If the Quarterdeck project create fails do we want to delete the project in trtl database, or do we want to retry Quarterdeck project create later?

// TODO: Distinguish between trtl errors and quarterdeck errors.
if err = s.createProject(ctx, tproject); err != nil {
log.Error().Err(err).Msg("could not create project")
c.JSON(qd.ErrorStatus(err), api.ErrorResponse("could not create project"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a trtl error what will qd.ErrorStatus(err) do - does it return a 500?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will return a 500. I was thinking we might want to have a struct similar to StatusError either in the tenant db package or in trtl so that we could switch on on the type here and return a more useful status code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me - would you mind creating a follow on story for that?

@pdeziel
Copy link
Contributor Author

pdeziel commented Feb 3, 2023

Looks good to me.

If the Quarterdeck project create fails do we want to delete the project in trtl database, or do we want to retry Quarterdeck project create later?

Good question - my current thinking is that we should just try to delete the project.

@pdeziel pdeziel merged commit 6792de1 into main Feb 3, 2023
@pdeziel pdeziel deleted the sc-13122 branch February 3, 2023 20:40
@bbengfort
Copy link
Contributor

Looks good to me.
If the Quarterdeck project create fails do we want to delete the project in trtl database, or do we want to retry Quarterdeck project create later?

Good question - my current thinking is that we should just try to delete the project.

Ok - deleting makes sense; do we have a story for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants