Skip to content

[PM-15179] Implement add-existing-organization-dialog.component #13010

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

Merged

Conversation

amorask-bitwarden
Copy link
Contributor

@amorask-bitwarden amorask-bitwarden commented Jan 22, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-15179

📔 Objective

This PR implements the new add-existing-organization-dialog.component to the Provider Portal.

server PR: bitwarden/server#5310

📸 Screenshots

  1. Provider owner adding existing organization
owner-add.mov
  1. Service user adding existing organization
service-user-add.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@amorask-bitwarden amorask-bitwarden marked this pull request as ready for review January 22, 2025 15:24
@amorask-bitwarden amorask-bitwarden requested review from a team as code owners January 22, 2025 15:24
Copy link
Contributor

github-actions bot commented Jan 22, 2025

Logo
Checkmarx One – Scan Summary & Details4bcbad16-a722-43ba-b9e3-23df5f9fdc31

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 1.44928% with 68 lines in your changes missing coverage. Please review.

Project coverage is 35.48%. Comparing base (444e928) to head (3306127).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ents/add-existing-organization-dialog.component.ts 0.00% 30 Missing ⚠️
...console/providers/services/web-provider.service.ts 0.00% 13 Missing ⚠️
...ling/providers/clients/manage-clients.component.ts 0.00% 12 Missing ⚠️
...e/models/response/addable-organization.response.ts 0.00% 8 Missing ⚠️
...-console/services/provider/provider-api.service.ts 0.00% 4 Missing ⚠️
...rc/app/admin-console/providers/providers.module.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13010      +/-   ##
==========================================
- Coverage   35.50%   35.48%   -0.03%     
==========================================
  Files        3008     3010       +2     
  Lines       90929    90996      +67     
  Branches    16914    16924      +10     
==========================================
+ Hits        32286    32287       +1     
- Misses      56141    56207      +66     
  Partials     2502     2502              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -40,6 +45,22 @@ export class WebProviderService {
return response;
}

async addExistingOrganization(providerId: string, organizationId: string): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

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

Will this replace the method immediately above it, addOrganizationToProvider? If so, can it use the vNext suffix or have a jsdoc comment to distinguish between them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f131e9c

Comment on lines 57 to 60
await this.billingApiService.addExistingOrganizationToProvider(providerId, {
key: encryptedOrgKey.encryptedString,
organizationId,
});
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be a billing-related api service or endpoint. The main action being done is to associate the provider with the organization, and the change in billing is only a side-effect. Looking at the server PR, ProviderClientsController (owned by Billing Team) seems to be slowly eroding ProviderOrganizationsController (owned by AC Team).

I think we need to maintain the team split here, where AC Team owns the general Provider Portal, its entities and their relationships, and there's some interface out to Billing Team's code to handle billing concerns. (Similar to how we own the creation of orgs, but billing code is called as a side-effect.)

In concrete terms for these PRs, this would mean:

  • in clients, billingApiService.addExistingOrganizationToProvider is moved into the ProviderApiService (which I'll move under our ownership)
  • in server, ProviderClientsController is merged into ProviderOrganizationsController
  • new dialog also potentially comes under AC ownership

I know Billing Team end up doing a lot of work in Provider Portal because it has a lot of billing impacts, but I want to avoid code just drifting between teams over time due to resource allocation by Product. Instead we should be building good interfaces between teams, or revisiting team boundaries.

Open for discussion here, let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eliykat Seems fair to me. The clients changes are easy. For server, does your team have a desired approach to endpoint naming with regards to legacy vs. consolidated billing endpoint versions?

For example:
POST /providers/{providerId}/organizations is the endpoint for legacy client creation.
When I pull the ProviderClientsController into this controller, how does your team want that endpoint to be named? POST /providers/{providers}/organizations/vnext or something along those lines?

Copy link
Member

Choose a reason for hiding this comment

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

Is the legacy endpoint, /providers/<id>/organizations, still needed for anything? Can it be deleted now, or will it be deleted eventually?

Given that the 2 controllers cleanly split old vs. new code, maybe keeping the ProviderClientsController but moving it under AC Team ownership is the simplest and easiest solution; rather than integrating old & new code and having to rip out old code later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It cannot be deleted yet. We do still have some providers on the old experience, but Priya mentioned to me those were going to be removed after some communication likely by the end of this quarter.

As such, in the server PR, I've moved the ProviderClientsController and associated tests under AC ownership. I'll manage the removal of all legacy Provider Portal code when we get the green-light to do so.

In this PR, I moved the new API calls to the provider-api.service and updated the web-provider.service method to use VNext.

@amorask-bitwarden
Copy link
Contributor Author

@eliykat Can I get another look here when you have a second based on this comment? #13010 (comment)

eliykat
eliykat previously approved these changes Jan 31, 2025
Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

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

My feedback has been addressed, thanks. I think we need to review provider code ownership generally but it doesn't need to hold you up here 👍

@amorask-bitwarden amorask-bitwarden merged commit cf7a174 into main Feb 4, 2025
84 of 86 checks passed
@amorask-bitwarden amorask-bitwarden deleted the billing/PM-15179/add-existing-orgs-provider-portal branch February 4, 2025 14:02
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.

3 participants