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

[PM-3478] Refactor OrganizationUser api #10949

Merged
merged 13 commits into from
Sep 30, 2024
Merged

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Sep 9, 2024

🎟️ Tracking

📔 Objective

From bitwarden/server#4752:

Introduce a new OrganizationUsers endpoint which provides a listing of all members' basic details - name, email address, status, role. Restrict access to the current endpoint which returns full details.

The new endpoint and models are called OrganizationUserUserMiniDetails, following the naming convention of CipherMiniDetails. Also because naming is hard, and "mini" is a relatively clear convention.

This PR refactors the client-side code to use the new endpoint.

Generally the components were not using the additional properties from the existing endpoint, so the new api call and model could be swapped in with no complaints from Typescript.

One exception is the collections dialog. Currently we fetch user-collection associations from the existing endpoint to check whether a user has access to the collection. However, this is already available when we load the collection data, using the collection.users property. I've updated it to use this instead, so we don't need the extra member info. I've also made a similar change to the group mapping logic for consistency and created a follow-up ticket to refactor that controller: AC-3035.

(I'd like to refactor how the access-selector works, I tried some small improvements here, but it seems like nothing short of a rewrite will cover all our current use cases. For another day.)

📸 Screenshots

⏰ 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

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 33.26%. Comparing base (0ecdd46) to head (c0d4530).
Report is 15 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/collection-dialog/collection-dialog.component.ts 0.00% 11 Missing ⚠️
...le/organizations/manage/entity-events.component.ts 0.00% 1 Missing ⚠️
...n-console/organizations/manage/events.component.ts 0.00% 1 Missing ⚠️
...e/organizations/manage/group-add-edit.component.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10949      +/-   ##
==========================================
+ Coverage   33.25%   33.26%   +0.01%     
==========================================
  Files        2731     2731              
  Lines       85298    85296       -2     
  Branches    16226    16226              
==========================================
+ Hits        28364    28372       +8     
+ Misses      54676    54666      -10     
  Partials     2258     2258              

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

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Logo
Checkmarx One – Scan Summary & Detailsee6cb8f8-a3ea-4d57-88bb-b9d6d01856ee

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/tools/generator/components/src/username-generator.component.html: 44 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/tools/generator/components/src/username-generator.component.html: 39 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/tools/generator/components/src/username-generator.component.html: 34 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/tools/generator/components/src/username-generator.component.html: 29 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/tools/generator/components/src/username-generator.component.html: 29 Attack Vector
MEDIUM Client_Privacy_Violation /libs/tools/send/send-ui/src/send-form/components/options/send-options.component.ts: 52 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /libs/tools/generator/components/src/username-generator.component.html: 3

@eliykat eliykat changed the title Ac/pm 3478/refactor member api [PM-3478] Refactor OrganizationUser api Sep 10, 2024
@eliykat eliykat marked this pull request as ready for review September 10, 2024 05:44
@eliykat eliykat requested review from a team as code owners September 10, 2024 05:44
addisonbeck
addisonbeck previously approved these changes Sep 10, 2024
Copy link
Contributor

@addisonbeck addisonbeck left a comment

Choose a reason for hiding this comment

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

Straight forward. Good work!

shane-melton
shane-melton previously approved these changes Sep 11, 2024
@eliykat eliykat added the needs-qa Marks a PR as requiring QA approval label Sep 11, 2024
addisonbeck
addisonbeck previously approved these changes Sep 18, 2024
shane-melton
shane-melton previously approved these changes Sep 19, 2024
@github-actions github-actions bot temporarily deployed to Web Vault - EU QA Cloud September 23, 2024 19:52 Inactive
@eliykat
Copy link
Member Author

eliykat commented Sep 27, 2024

I've put the new API call behind a feature flag in DefaultOrganizationUserApiService. If the flag is disabled, the new api call will just redirect to the old one. Corresponding changes have been made to the server PR.

@eliykat eliykat removed the needs-qa Marks a PR as requiring QA approval label Sep 27, 2024
@eliykat eliykat merged commit 1f85036 into main Sep 30, 2024
66 checks passed
@eliykat eliykat deleted the ac/pm-3478/refactor-member-api branch September 30, 2024 21:13
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