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-17168] Sync organization user revoked/restored status immediately via push notification #13101

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

r-tome
Copy link
Contributor

@r-tome r-tome commented Jan 28, 2025

🎟️ Tracking

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

📔 Objective

Revoking/restoring user is not synced immediately via push notification

This PR updates the NotificationsService to handle messages of type NotificationType.SyncOrgKeys by refreshing the identity token.

I also noticed that the SignalR connection stops when receiving a NotificationType.SyncOrgKeys message but does not restart automatically. To fix this, I updated the reconnect method to re-setup the connection.

Server PR.

📸 Screenshots

Revoking and restoring a user a couple of times:

Screen.Recording.2025-01-28.at.12.41.05.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

@r-tome r-tome changed the title [PM17168] Sync organization user revoked/restored status immediately via push notification [PM-17168] Sync organization user revoked/restored status immediately via push notification Jan 28, 2025
@r-tome r-tome requested review from a team and BTreston January 28, 2025 12:51
Copy link
Contributor

github-actions bot commented Jan 28, 2025

Logo
Checkmarx One – Scan Summary & Details149f77aa-36e9-4162-b80e-583a60248976

Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/avatar/avatar.component.ts: 87

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 35.42%. Comparing base (72434bf) to head (3b144ba).

Files with missing lines Patch % Lines
...ications/internal/default-notifications.service.ts 60.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13101   +/-   ##
=======================================
  Coverage   35.41%   35.42%           
=======================================
  Files        3007     3007           
  Lines       90716    90722    +6     
  Branches    16858    16859    +1     
=======================================
+ Hits        32129    32140   +11     
+ Misses      56123    56118    -5     
  Partials     2464     2464           

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

@r-tome r-tome marked this pull request as ready for review January 28, 2025 14:28
@r-tome
Copy link
Contributor Author

r-tome commented Jan 30, 2025

I'm closing this because only the server change is required.

@r-tome r-tome closed this Jan 30, 2025
@r-tome r-tome reopened this Feb 3, 2025
@r-tome r-tome requested a review from a team as a code owner February 3, 2025 14:49
@r-tome
Copy link
Contributor Author

r-tome commented Feb 3, 2025

Reopening this PR — @eliykat explained that we need to refresh the identity token to update the claims.

BTreston
BTreston previously approved these changes Feb 3, 2025
eliykat
eliykat previously approved these changes Feb 3, 2025
@@ -182,6 +187,9 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
await this.syncService.fullSync(true);
break;
case NotificationType.SyncOrgKeys:
if (await this.configService.getFeatureFlag(FeatureFlag.PushSyncOrgKeysOnRevokeRestore)) {
await this.apiService.refreshIdentityToken();
Copy link
Member

@eliykat eliykat Feb 3, 2025

Choose a reason for hiding this comment

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

I think a comment here would be useful, e.g. // refresh identity token to update organization roles in the JWT claims.

@r-tome r-tome dismissed stale reviews from eliykat and BTreston via 1764a8b February 4, 2025 09:33
@r-tome r-tome requested a review from BTreston February 4, 2025 09:33
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