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-10311] Account Management: Create helper methods for checking against verified domains #4636

Conversation

r-tome
Copy link
Contributor

@r-tome r-tome commented Aug 15, 2024

🎟️ Tracking

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

📔 Objective

The Account Management MVP will introduce managed and unmanaged members. This PR aims to add server methods to identify managed users.

⏰ 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
Contributor

github-actions bot commented Aug 15, 2024

Logo
Checkmarx One – Scan Summary & Details27ed9e7f-e66c-43d5-8d48-69fba408ac61

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 218
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 540
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 272
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 554
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 346
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 326
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 244
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 100
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 286
MEDIUM Privacy_Violation /src/Core/Services/Implementations/UserService.cs: 709
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 286
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 272
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 286
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 272
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 286
LOW Log_Forging /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 272

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 32.92683% with 55 lines in your changes missing coverage. Please review.

Project coverage is 41.73%. Comparing base (3f11274) to head (975e70a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...zationUserReadByClaimedOrganizationDomainsQuery.cs 0.00% 15 Missing ⚠️
...dminConsole/Repositories/OrganizationRepository.cs 0.00% 14 Missing ⚠️
...dminConsole/Repositories/OrganizationRepository.cs 0.00% 9 Missing ⚠️
...Console/Repositories/OrganizationUserRepository.cs 0.00% 9 Missing ⚠️
...Console/Repositories/OrganizationUserRepository.cs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4636      +/-   ##
==========================================
- Coverage   41.74%   41.73%   -0.02%     
==========================================
  Files        1304     1306       +2     
  Lines       61841    61923      +82     
  Branches     5694     5697       +3     
==========================================
+ Hits        25818    25845      +27     
- Misses      34835    34890      +55     
  Partials     1188     1188              

☔ 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 August 16, 2024 13:38
@r-tome r-tome requested review from a team as code owners August 16, 2024 13:38
@r-tome r-tome marked this pull request as draft August 16, 2024 13:55
@r-tome r-tome marked this pull request as ready for review August 17, 2024 11:04
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.

Quick feedback. This wasn't really a comprehensive review - I'll get back to it.

src/Core/AdminConsole/Services/IOrganizationService.cs Outdated Show resolved Hide resolved
/// <summary>
/// Indicates if the organization has any verified domains.
/// </summary>
Task<bool> HasVerifiedDomainsAsync(Guid orgId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should OrganizationDomainService be in the AdminConsole folder for code ownership purposes? We can move it without changing the namespace to avoid breaking imports if there are a lot of them, but while we're here it makes sense to move it if this a part of ACs domain.

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 moved the namespace, there were only two references.

eliykat
eliykat previously approved these changes Sep 1, 2024
@eliykat
Copy link
Member

eliykat commented Sep 1, 2024

(But please get @addisonbeck's final review)

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.

Very small nitpick.

{
// Users can only be managed by an Organization that is enabled and can have organization domains
var organizationAbility = await _applicationCacheService.GetOrganizationAbilityAsync(organizationId);
if (organizationAbility is { Enabled: true, UseSso: true })
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we've identified that UseSso is not very apt here and are going to improve this as tech debt: lets add a comment here indicating that UseSso is used to signify that the organization has access to domain verification. Bonus points if it includes a link to a Jira ticket.

Copy link
Member

Choose a reason for hiding this comment

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

I said I'd follow this up, so I've created a ticket for it here that you can link to: https://bitwarden.atlassian.net/browse/PM-11622

addisonbeck
addisonbeck previously approved these changes Sep 4, 2024
…ng-against-verified-domains

# Conflicts:
#	src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs
addisonbeck
addisonbeck previously approved these changes Sep 5, 2024
Copy link
Contributor

@rkac-bw rkac-bw left a comment

Choose a reason for hiding this comment

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

lgtm

@r-tome r-tome merged commit f2180aa into main Sep 11, 2024
54 checks passed
@r-tome r-tome deleted the ac/pm-10311/create-helper-methods-for-checking-against-verified-domains branch September 11, 2024 10:30
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.

5 participants