Skip to content

Commit 1e631a7

Browse files
Merge branch 'main' into auth/pm-34130/fix-device-auth-details-constructor-not-edd-compliant
2 parents 17980b0 + a07ebc1 commit 1e631a7

160 files changed

Lines changed: 16251 additions & 3566 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180

181181
########## Registries ##########
182182
- name: Log in to GHCR
183-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
183+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
184184
with:
185185
registry: ghcr.io
186186
username: ${{ github.actor }}
@@ -322,7 +322,7 @@ jobs:
322322
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
323323

324324
- name: Log in to GHCR
325-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
325+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
326326
with:
327327
registry: ghcr.io
328328
username: ${{ github.actor }}

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
112112
########## GHCR ##########
113113
- name: Log in to GHCR
114-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
114+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
115115
with:
116116
registry: ghcr.io
117117
username: ${{ github.actor }}

bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class ProviderService : IProviderService
5757
private readonly IOrganizationService _organizationService;
5858
private readonly ICurrentContext _currentContext;
5959
private readonly IStripeAdapter _stripeAdapter;
60-
private readonly IFeatureService _featureService;
6160
private readonly IDataProtectorTokenFactory<ProviderDeleteTokenable> _providerDeleteTokenDataFactory;
6261
private readonly IApplicationCacheService _applicationCacheService;
6362
private readonly IProviderBillingService _providerBillingService;
@@ -70,7 +69,7 @@ public ProviderService(IProviderRepository providerRepository, IProviderUserRepo
7069
IUserService userService, IOrganizationService organizationService, IMailService mailService,
7170
IDataProtectionProvider dataProtectionProvider, IEventService eventService,
7271
IOrganizationRepository organizationRepository, GlobalSettings globalSettings,
73-
ICurrentContext currentContext, IStripeAdapter stripeAdapter, IFeatureService featureService,
72+
ICurrentContext currentContext, IStripeAdapter stripeAdapter,
7473
IDataProtectorTokenFactory<ProviderDeleteTokenable> providerDeleteTokenDataFactory,
7574
IApplicationCacheService applicationCacheService, IProviderBillingService providerBillingService, IPricingClient pricingClient,
7675
IProviderClientOrganizationSignUpCommand providerClientOrganizationSignUpCommand,
@@ -89,7 +88,6 @@ public ProviderService(IProviderRepository providerRepository, IProviderUserRepo
8988
_dataProtector = dataProtectionProvider.CreateProtector("ProviderServiceDataProtector");
9089
_currentContext = currentContext;
9190
_stripeAdapter = stripeAdapter;
92-
_featureService = featureService;
9391
_providerDeleteTokenDataFactory = providerDeleteTokenDataFactory;
9492
_applicationCacheService = applicationCacheService;
9593
_providerBillingService = providerBillingService;
@@ -123,16 +121,13 @@ public async Task<Provider> CompleteSetupAsync(Provider provider, Guid ownerUser
123121
throw new BadRequestException("Invalid owner.");
124122
}
125123

126-
if (_featureService.IsEnabled(FeatureFlagKeys.AutomaticConfirmUsers))
127-
{
128-
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
129-
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(ownerUserId);
124+
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
125+
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(ownerUserId);
130126

131-
if (organizationAutoConfirmPolicyRequirement
132-
.CannotCreateProvider())
133-
{
134-
throw new BadRequestException(new UserCannotJoinProvider().Message);
135-
}
127+
if (organizationAutoConfirmPolicyRequirement
128+
.CannotCreateProvider())
129+
{
130+
throw new BadRequestException(new UserCannotJoinProvider().Message);
136131
}
137132

138133
var customer = await _providerBillingService.SetupCustomer(provider, paymentMethod, billingAddress);
@@ -267,16 +262,13 @@ public async Task<ProviderUser> AcceptUserAsync(Guid providerUserId, User user,
267262
throw new BadRequestException("User email does not match invite.");
268263
}
269264

270-
if (_featureService.IsEnabled(FeatureFlagKeys.AutomaticConfirmUsers))
271-
{
272-
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
273-
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(user.Id);
265+
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
266+
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(user.Id);
274267

275-
if (organizationAutoConfirmPolicyRequirement
276-
.CannotJoinProvider())
277-
{
278-
throw new BadRequestException(new UserCannotJoinProvider().Message);
279-
}
268+
if (organizationAutoConfirmPolicyRequirement
269+
.CannotJoinProvider())
270+
{
271+
throw new BadRequestException(new UserCannotJoinProvider().Message);
280272
}
281273

282274
providerUser.Status = ProviderUserStatusType.Accepted;
@@ -324,17 +316,14 @@ public async Task<List<Tuple<ProviderUser, string>>> ConfirmUsersAsync(Guid prov
324316
throw new BadRequestException("Invalid user.");
325317
}
326318

327-
if (_featureService.IsEnabled(FeatureFlagKeys.AutomaticConfirmUsers))
328-
{
329-
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
330-
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(user.Id);
319+
var organizationAutoConfirmPolicyRequirement = await _policyRequirementQuery
320+
.GetAsync<AutomaticUserConfirmationPolicyRequirement>(user.Id);
331321

332-
if (organizationAutoConfirmPolicyRequirement
333-
.CannotJoinProvider())
334-
{
335-
result.Add(Tuple.Create(providerUser, new UserCannotJoinProvider().Message));
336-
continue;
337-
}
322+
if (organizationAutoConfirmPolicyRequirement
323+
.CannotJoinProvider())
324+
{
325+
result.Add(Tuple.Create(providerUser, new UserCannotJoinProvider().Message));
326+
continue;
338327
}
339328

340329
providerUser.Status = ProviderUserStatusType.Confirmed;

bitwarden_license/src/Scim/Controllers/v2/UsersController.cs

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
// FIXME: Update this file to be null safe and then delete the line below
22
#nullable disable
33

4-
using Bit.Core;
54
using Bit.Core.AdminConsole.Models.Data;
65
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces;
76
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.RestoreUser.v1;
87
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.RevokeUser.v2;
98
using Bit.Core.Enums;
109
using Bit.Core.Exceptions;
1110
using Bit.Core.Repositories;
12-
using Bit.Core.Services;
1311
using Bit.Scim.Models;
1412
using Bit.Scim.Users.Interfaces;
1513
using Bit.Scim.Utilities;
1614
using Microsoft.AspNetCore.Authorization;
1715
using Microsoft.AspNetCore.Mvc;
18-
using IRevokeOrganizationUserCommand = Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.RevokeUser.v1.IRevokeOrganizationUserCommand;
1916
using IRevokeOrganizationUserCommandV2 = Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.RevokeUser.v2.IRevokeOrganizationUserCommand;
2017

2118
namespace Bit.Scim.Controllers.v2;
@@ -32,8 +29,6 @@ public class UsersController : Controller
3229
private readonly IPatchUserCommand _patchUserCommand;
3330
private readonly IPostUserCommand _postUserCommand;
3431
private readonly IRestoreOrganizationUserCommand _restoreOrganizationUserCommand;
35-
private readonly IRevokeOrganizationUserCommand _revokeOrganizationUserCommand;
36-
private readonly IFeatureService _featureService;
3732
private readonly IRevokeOrganizationUserCommandV2 _revokeOrganizationUserCommandV2;
3833

3934
public UsersController(IOrganizationUserRepository organizationUserRepository,
@@ -42,8 +37,6 @@ public UsersController(IOrganizationUserRepository organizationUserRepository,
4237
IPatchUserCommand patchUserCommand,
4338
IPostUserCommand postUserCommand,
4439
IRestoreOrganizationUserCommand restoreOrganizationUserCommand,
45-
IRevokeOrganizationUserCommand revokeOrganizationUserCommand,
46-
IFeatureService featureService,
4740
IRevokeOrganizationUserCommandV2 revokeOrganizationUserCommandV2)
4841
{
4942
_organizationUserRepository = organizationUserRepository;
@@ -52,8 +45,6 @@ public UsersController(IOrganizationUserRepository organizationUserRepository,
5245
_patchUserCommand = patchUserCommand;
5346
_postUserCommand = postUserCommand;
5447
_restoreOrganizationUserCommand = restoreOrganizationUserCommand;
55-
_revokeOrganizationUserCommand = revokeOrganizationUserCommand;
56-
_featureService = featureService;
5748
_revokeOrganizationUserCommandV2 = revokeOrganizationUserCommandV2;
5849
}
5950

@@ -111,32 +102,25 @@ public async Task<IActionResult> Put(Guid organizationId, Guid id, [FromBody] Sc
111102
}
112103
else if (!model.Active && orgUser.Status != OrganizationUserStatusType.Revoked)
113104
{
114-
if (_featureService.IsEnabled(FeatureFlagKeys.ScimRevokeV2))
115-
{
116-
var results = await _revokeOrganizationUserCommandV2.RevokeUsersAsync(
117-
new RevokeOrganizationUsersRequest(
118-
organizationId,
119-
[id],
120-
new SystemUser(EventSystemUser.SCIM)));
105+
var results = await _revokeOrganizationUserCommandV2.RevokeUsersAsync(
106+
new RevokeOrganizationUsersRequest(
107+
organizationId,
108+
[id],
109+
new SystemUser(EventSystemUser.SCIM)));
121110

122-
var errors = results.Select(x => x.Result.Match(
123-
y => $"{y.Message} for user {x.Id}",
124-
_ => null))
125-
.Where(x => !string.IsNullOrWhiteSpace(x))
126-
.ToList();
111+
var errors = results.Select(x => x.Result.Match(
112+
y => $"{y.Message} for user {x.Id}",
113+
_ => null))
114+
.Where(x => !string.IsNullOrWhiteSpace(x))
115+
.ToList();
127116

128-
if (errors.Count != 0)
129-
{
130-
return new BadRequestObjectResult(new ScimErrorResponseModel
131-
{
132-
Status = 400,
133-
Detail = string.Join(", ", errors)
134-
});
135-
}
136-
}
137-
else
117+
if (errors.Count != 0)
138118
{
139-
await _revokeOrganizationUserCommand.RevokeUserAsync(orgUser, EventSystemUser.SCIM);
119+
return new BadRequestObjectResult(new ScimErrorResponseModel
120+
{
121+
Status = 400,
122+
Detail = string.Join(", ", errors)
123+
});
140124
}
141125
}
142126

0 commit comments

Comments
 (0)