Skip to content

Conversation

@jrmccannon
Copy link
Contributor

@jrmccannon jrmccannon commented Jan 21, 2026

🎟️ Tracking

PM-28627

📔 Objective

When restoring a user from the internal endpoint and the organiation has the Data Ownership policy enabled, we would like to create the default user collection for the user if it does not exist already. This uses an idemponent call to do so.

For the single user endpoint, there is a vNext version protected by a feature flag since a request body was added to hold the encrypted default collection name. The default user collection name property was added to the bulk method request model.

📸 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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Logo
Checkmarx One – Scan Summary & Detailscc59dd5c-2de3-4f0e-9d74-09d496393765

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 78.37838% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.07%. Comparing base (8cf05d8) to head (bf7e903).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...Console/Controllers/OrganizationUsersController.cs 0.00% 7 Missing ⚠️
...st/Organizations/OrganizationUserRestoreRequest.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6879   +/-   ##
=======================================
  Coverage   56.07%   56.07%           
=======================================
  Files        1968     1969    +1     
  Lines       86927    86956   +29     
  Branches     7742     7744    +2     
=======================================
+ Hits        48741    48763   +22     
- Misses      36385    36392    +7     
  Partials     1801     1801           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrmccannon jrmccannon added the ai-review Request a Claude code review label Jan 21, 2026
@claude
Copy link
Contributor

claude bot commented Jan 22, 2026

Claude finished @jrmccannon's task in 2m 42s —— View job


Code Review: PM-28627 Create Default Collection Restore

Verdict: 🟢 Approved - Previous finding resolved, implementation is sound.

Summary

This PR implements the ability to create default collections when restoring organization users who have the Data Ownership policy enabled. The feature is protected by the DefaultUserCollectionRestore feature flag.

Re-Review Assessment

Previous Finding Status
Missing audit events for invited users in bulk restore Resolved - Event logging now at line 257, outside the if (UserId.HasValue) block

Implementation Verified

Architecture:

  • New vNext endpoint (PUT {id}/restore/vnext) with feature flag protection
  • Interface updated with optional defaultCollectionName parameter (nullable, backward compatible)
  • Single-user and bulk restore paths both correctly gate collection creation

Security:

  • Collection name is encrypted client-side (maintains zero-knowledge)
  • [EncryptedString] and [EncryptedStringLength(1000)] validation attributes applied to both request models
  • [FromBody] attribute correctly added to vNext endpoint
  • Authorization via ManageUsersRequirement

Correctness:

  • Collection creation requires all conditions:
    • User has UserId (linked account)
    • Data Ownership policy enabled for user
    • User restores to Confirmed status (not Invited)
    • Feature flag enabled
    • Collection name is not null/empty/whitespace

Test Coverage:

  • 400+ lines of new tests covering:
    • Policy enabled/disabled states
    • Feature flag on/off
    • Null, empty, and whitespace collection names
    • Confirmed vs Invited user status
    • Single-user and bulk restore scenarios

🤖 Claude Code Review | Run by @jrmccannon

@jrmccannon jrmccannon marked this pull request as ready for review January 22, 2026 19:59
@jrmccannon jrmccannon requested a review from a team as a code owner January 22, 2026 19:59
@jrmccannon jrmccannon requested a review from eliykat January 22, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants