mirror of
https://github.com/bitwarden/server.git
synced 2025-12-11 13:53:48 -06:00
[PM-26361] Add User Auto Confirmation (#6436)
* Adding AutoConfrim and migrations. * Add value to Admin Page and update sproc to correct name. * Correcting license constant. * Adding feature check back in. * Fixing sprocs :face_palm: * Remove Coalesce * Adding property to plan and model constructor * Correcting name of column. Cascading change throughout. Updating response models. Updating sprocs and views. Updating migrations * fixing sproc * Fixing up license stuff. * Updating org view * Code review changes and renames :face_palm: * Refershing additional views * Last two fixes.
This commit is contained in:
parent
4bf7cf956b
commit
dbce45291c
@ -472,6 +472,7 @@ public class OrganizationsController : Controller
|
|||||||
organization.UseRiskInsights = model.UseRiskInsights;
|
organization.UseRiskInsights = model.UseRiskInsights;
|
||||||
organization.UseOrganizationDomains = model.UseOrganizationDomains;
|
organization.UseOrganizationDomains = model.UseOrganizationDomains;
|
||||||
organization.UseAdminSponsoredFamilies = model.UseAdminSponsoredFamilies;
|
organization.UseAdminSponsoredFamilies = model.UseAdminSponsoredFamilies;
|
||||||
|
organization.UseAutomaticUserConfirmation = model.UseAutomaticUserConfirmation;
|
||||||
|
|
||||||
//secrets
|
//secrets
|
||||||
organization.SmSeats = model.SmSeats;
|
organization.SmSeats = model.SmSeats;
|
||||||
|
|||||||
@ -106,6 +106,8 @@ public class OrganizationEditModel : OrganizationViewModel
|
|||||||
SmServiceAccounts = org.SmServiceAccounts;
|
SmServiceAccounts = org.SmServiceAccounts;
|
||||||
MaxAutoscaleSmServiceAccounts = org.MaxAutoscaleSmServiceAccounts;
|
MaxAutoscaleSmServiceAccounts = org.MaxAutoscaleSmServiceAccounts;
|
||||||
UseOrganizationDomains = org.UseOrganizationDomains;
|
UseOrganizationDomains = org.UseOrganizationDomains;
|
||||||
|
UseAutomaticUserConfirmation = org.UseAutomaticUserConfirmation;
|
||||||
|
|
||||||
_plans = plans;
|
_plans = plans;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +194,8 @@ public class OrganizationEditModel : OrganizationViewModel
|
|||||||
[Display(Name = "Use Organization Domains")]
|
[Display(Name = "Use Organization Domains")]
|
||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Automatic User Confirmation")]
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
/**
|
/**
|
||||||
* Creates a Plan[] object for use in Javascript
|
* Creates a Plan[] object for use in Javascript
|
||||||
* This is mapped manually below to provide some type safety in case the plan objects change
|
* This is mapped manually below to provide some type safety in case the plan objects change
|
||||||
@ -231,6 +235,7 @@ public class OrganizationEditModel : OrganizationViewModel
|
|||||||
LegacyYear = p.LegacyYear,
|
LegacyYear = p.LegacyYear,
|
||||||
Disabled = p.Disabled,
|
Disabled = p.Disabled,
|
||||||
SupportsSecretsManager = p.SupportsSecretsManager,
|
SupportsSecretsManager = p.SupportsSecretsManager,
|
||||||
|
AutomaticUserConfirmation = p.AutomaticUserConfirmation,
|
||||||
PasswordManager =
|
PasswordManager =
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
|
|||||||
@ -159,6 +159,13 @@
|
|||||||
<label class="form-check-label" asp-for="UseAdminSponsoredFamilies"></label>
|
<label class="form-check-label" asp-for="UseAdminSponsoredFamilies"></label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@if(FeatureService.IsEnabled(FeatureFlagKeys.AutomaticConfirmUsers))
|
||||||
|
{
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" asp-for="UseAutomaticUserConfirmation" disabled='@(canEditPlan ? null : "disabled")'>
|
||||||
|
<label class="form-check-label" asp-for="UseAutomaticUserConfirmation"></label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<h3>Password Manager</h3>
|
<h3>Password Manager</h3>
|
||||||
|
|||||||
@ -70,6 +70,7 @@ public class OrganizationResponseModel : ResponseModel
|
|||||||
UseRiskInsights = organization.UseRiskInsights;
|
UseRiskInsights = organization.UseRiskInsights;
|
||||||
UseOrganizationDomains = organization.UseOrganizationDomains;
|
UseOrganizationDomains = organization.UseOrganizationDomains;
|
||||||
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
||||||
|
UseAutomaticUserConfirmation = organization.UseAutomaticUserConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
@ -118,6 +119,7 @@ public class OrganizationResponseModel : ResponseModel
|
|||||||
public bool UseRiskInsights { get; set; }
|
public bool UseRiskInsights { get; set; }
|
||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
public bool UseAdminSponsoredFamilies { get; set; }
|
public bool UseAdminSponsoredFamilies { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrganizationSubscriptionResponseModel : OrganizationResponseModel
|
public class OrganizationSubscriptionResponseModel : OrganizationResponseModel
|
||||||
|
|||||||
@ -87,6 +87,8 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
|||||||
KeyConnectorUrl = ssoConfigData.KeyConnectorUrl;
|
KeyConnectorUrl = ssoConfigData.KeyConnectorUrl;
|
||||||
SsoMemberDecryptionType = ssoConfigData.MemberDecryptionType;
|
SsoMemberDecryptionType = ssoConfigData.MemberDecryptionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseAutomaticUserConfirmation = organization.UseAutomaticUserConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
@ -164,4 +166,5 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
|||||||
public bool IsAdminInitiated { get; set; }
|
public bool IsAdminInitiated { get; set; }
|
||||||
public bool SsoEnabled { get; set; }
|
public bool SsoEnabled { get; set; }
|
||||||
public MemberDecryptionType? SsoMemberDecryptionType { get; set; }
|
public MemberDecryptionType? SsoMemberDecryptionType { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,5 +52,6 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
|
|||||||
UseRiskInsights = organization.UseRiskInsights;
|
UseRiskInsights = organization.UseRiskInsights;
|
||||||
UseOrganizationDomains = organization.UseOrganizationDomains;
|
UseOrganizationDomains = organization.UseOrganizationDomains;
|
||||||
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
||||||
|
UseAutomaticUserConfirmation = organization.UseAutomaticUserConfirmation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,6 +129,11 @@ public class Organization : ITableObject<Guid>, IStorableSubscriber, IRevisable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SyncSeats { get; set; }
|
public bool SyncSeats { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If set to true, user accounts created within the organization are automatically confirmed without requiring additional verification steps.
|
||||||
|
/// </summary>
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
|
|
||||||
public void SetNewId()
|
public void SetNewId()
|
||||||
{
|
{
|
||||||
if (Id == default(Guid))
|
if (Id == default(Guid))
|
||||||
|
|||||||
@ -28,6 +28,7 @@ public class OrganizationAbility
|
|||||||
UseRiskInsights = organization.UseRiskInsights;
|
UseRiskInsights = organization.UseRiskInsights;
|
||||||
UseOrganizationDomains = organization.UseOrganizationDomains;
|
UseOrganizationDomains = organization.UseOrganizationDomains;
|
||||||
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
UseAdminSponsoredFamilies = organization.UseAdminSponsoredFamilies;
|
||||||
|
UseAutomaticUserConfirmation = organization.UseAutomaticUserConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
@ -49,4 +50,5 @@ public class OrganizationAbility
|
|||||||
public bool UseRiskInsights { get; set; }
|
public bool UseRiskInsights { get; set; }
|
||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
public bool UseAdminSponsoredFamilies { get; set; }
|
public bool UseAdminSponsoredFamilies { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,4 +66,5 @@ public class OrganizationUserOrganizationDetails
|
|||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
public bool UseAdminSponsoredFamilies { get; set; }
|
public bool UseAdminSponsoredFamilies { get; set; }
|
||||||
public bool? IsAdminInitiated { get; set; }
|
public bool? IsAdminInitiated { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,4 +51,5 @@ public class ProviderUserOrganizationDetails
|
|||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
public bool UseAdminSponsoredFamilies { get; set; }
|
public bool UseAdminSponsoredFamilies { get; set; }
|
||||||
public ProviderType ProviderType { get; set; }
|
public ProviderType ProviderType { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,7 @@ public static class OrganizationFactory
|
|||||||
claimsPrincipal.GetValue<bool>(OrganizationLicenseConstants.UseOrganizationDomains),
|
claimsPrincipal.GetValue<bool>(OrganizationLicenseConstants.UseOrganizationDomains),
|
||||||
UseAdminSponsoredFamilies =
|
UseAdminSponsoredFamilies =
|
||||||
claimsPrincipal.GetValue<bool>(OrganizationLicenseConstants.UseAdminSponsoredFamilies),
|
claimsPrincipal.GetValue<bool>(OrganizationLicenseConstants.UseAdminSponsoredFamilies),
|
||||||
|
UseAutomaticUserConfirmation = claimsPrincipal.GetValue<bool>(OrganizationLicenseConstants.UseAutomaticUserConfirmation),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Organization Create(
|
public static Organization Create(
|
||||||
|
|||||||
@ -43,6 +43,7 @@ public static class OrganizationLicenseConstants
|
|||||||
public const string Trial = nameof(Trial);
|
public const string Trial = nameof(Trial);
|
||||||
public const string UseAdminSponsoredFamilies = nameof(UseAdminSponsoredFamilies);
|
public const string UseAdminSponsoredFamilies = nameof(UseAdminSponsoredFamilies);
|
||||||
public const string UseOrganizationDomains = nameof(UseOrganizationDomains);
|
public const string UseOrganizationDomains = nameof(UseOrganizationDomains);
|
||||||
|
public const string UseAutomaticUserConfirmation = nameof(UseAutomaticUserConfirmation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UserLicenseConstants
|
public static class UserLicenseConstants
|
||||||
|
|||||||
@ -56,6 +56,7 @@ public class OrganizationLicenseClaimsFactory : ILicenseClaimsFactory<Organizati
|
|||||||
new(nameof(OrganizationLicenseConstants.Trial), trial.ToString()),
|
new(nameof(OrganizationLicenseConstants.Trial), trial.ToString()),
|
||||||
new(nameof(OrganizationLicenseConstants.UseAdminSponsoredFamilies), entity.UseAdminSponsoredFamilies.ToString()),
|
new(nameof(OrganizationLicenseConstants.UseAdminSponsoredFamilies), entity.UseAdminSponsoredFamilies.ToString()),
|
||||||
new(nameof(OrganizationLicenseConstants.UseOrganizationDomains), entity.UseOrganizationDomains.ToString()),
|
new(nameof(OrganizationLicenseConstants.UseOrganizationDomains), entity.UseOrganizationDomains.ToString()),
|
||||||
|
new(nameof(OrganizationLicenseConstants.UseAutomaticUserConfirmation), entity.UseAutomaticUserConfirmation.ToString()),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (entity.Name is not null)
|
if (entity.Name is not null)
|
||||||
|
|||||||
@ -43,6 +43,8 @@ public abstract record Plan
|
|||||||
public SecretsManagerPlanFeatures SecretsManager { get; protected init; }
|
public SecretsManagerPlanFeatures SecretsManager { get; protected init; }
|
||||||
public bool SupportsSecretsManager => SecretsManager != null;
|
public bool SupportsSecretsManager => SecretsManager != null;
|
||||||
|
|
||||||
|
public bool AutomaticUserConfirmation { get; init; }
|
||||||
|
|
||||||
public bool HasNonSeatBasedPasswordManagerPlan() =>
|
public bool HasNonSeatBasedPasswordManagerPlan() =>
|
||||||
PasswordManager is { StripePlanId: not null and not "", StripeSeatPlanId: null or "" };
|
PasswordManager is { StripePlanId: not null and not "", StripeSeatPlanId: null or "" };
|
||||||
|
|
||||||
|
|||||||
@ -153,6 +153,7 @@ public class OrganizationLicense : ILicense
|
|||||||
public LicenseType? LicenseType { get; set; }
|
public LicenseType? LicenseType { get; set; }
|
||||||
public bool UseOrganizationDomains { get; set; }
|
public bool UseOrganizationDomains { get; set; }
|
||||||
public bool UseAdminSponsoredFamilies { get; set; }
|
public bool UseAdminSponsoredFamilies { get; set; }
|
||||||
|
public bool UseAutomaticUserConfirmation { get; set; }
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
public string Signature { get; set; }
|
public string Signature { get; set; }
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
@ -226,7 +227,8 @@ public class OrganizationLicense : ILicense
|
|||||||
// any new fields added need to be added here so that they're ignored
|
// any new fields added need to be added here so that they're ignored
|
||||||
!p.Name.Equals(nameof(UseRiskInsights)) &&
|
!p.Name.Equals(nameof(UseRiskInsights)) &&
|
||||||
!p.Name.Equals(nameof(UseAdminSponsoredFamilies)) &&
|
!p.Name.Equals(nameof(UseAdminSponsoredFamilies)) &&
|
||||||
!p.Name.Equals(nameof(UseOrganizationDomains)))
|
!p.Name.Equals(nameof(UseOrganizationDomains)) &&
|
||||||
|
!p.Name.Equals(nameof(UseAutomaticUserConfirmation)))
|
||||||
.OrderBy(p => p.Name)
|
.OrderBy(p => p.Name)
|
||||||
.Select(p => $"{p.Name}:{Core.Utilities.CoreHelpers.FormatLicenseSignatureValue(p.GetValue(this, null))}")
|
.Select(p => $"{p.Name}:{Core.Utilities.CoreHelpers.FormatLicenseSignatureValue(p.GetValue(this, null))}")
|
||||||
.Aggregate((c, n) => $"{c}|{n}");
|
.Aggregate((c, n) => $"{c}|{n}");
|
||||||
@ -421,6 +423,7 @@ public class OrganizationLicense : ILicense
|
|||||||
var smServiceAccounts = claimsPrincipal.GetValue<int?>(nameof(SmServiceAccounts));
|
var smServiceAccounts = claimsPrincipal.GetValue<int?>(nameof(SmServiceAccounts));
|
||||||
var useAdminSponsoredFamilies = claimsPrincipal.GetValue<bool>(nameof(UseAdminSponsoredFamilies));
|
var useAdminSponsoredFamilies = claimsPrincipal.GetValue<bool>(nameof(UseAdminSponsoredFamilies));
|
||||||
var useOrganizationDomains = claimsPrincipal.GetValue<bool>(nameof(UseOrganizationDomains));
|
var useOrganizationDomains = claimsPrincipal.GetValue<bool>(nameof(UseOrganizationDomains));
|
||||||
|
var useAutomaticUserConfirmation = claimsPrincipal.GetValue<bool>(nameof(UseAutomaticUserConfirmation));
|
||||||
|
|
||||||
return issued <= DateTime.UtcNow &&
|
return issued <= DateTime.UtcNow &&
|
||||||
expires >= DateTime.UtcNow &&
|
expires >= DateTime.UtcNow &&
|
||||||
@ -450,7 +453,8 @@ public class OrganizationLicense : ILicense
|
|||||||
smSeats == organization.SmSeats &&
|
smSeats == organization.SmSeats &&
|
||||||
smServiceAccounts == organization.SmServiceAccounts &&
|
smServiceAccounts == organization.SmServiceAccounts &&
|
||||||
useAdminSponsoredFamilies == organization.UseAdminSponsoredFamilies &&
|
useAdminSponsoredFamilies == organization.UseAdminSponsoredFamilies &&
|
||||||
useOrganizationDomains == organization.UseOrganizationDomains;
|
useOrganizationDomains == organization.UseOrganizationDomains &&
|
||||||
|
useAutomaticUserConfirmation == organization.UseAutomaticUserConfirmation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,7 @@ public static class FeatureFlagKeys
|
|||||||
public const string EventBasedOrganizationIntegrations = "event-based-organization-integrations";
|
public const string EventBasedOrganizationIntegrations = "event-based-organization-integrations";
|
||||||
public const string SeparateCustomRolePermissions = "pm-19917-separate-custom-role-permissions";
|
public const string SeparateCustomRolePermissions = "pm-19917-separate-custom-role-permissions";
|
||||||
public const string CreateDefaultLocation = "pm-19467-create-default-location";
|
public const string CreateDefaultLocation = "pm-19467-create-default-location";
|
||||||
|
public const string AutomaticConfirmUsers = "pm-19934-auto-confirm-organization-users";
|
||||||
public const string PM23845_VNextApplicationCache = "pm-24957-refactor-memory-application-cache";
|
public const string PM23845_VNextApplicationCache = "pm-24957-refactor-memory-application-cache";
|
||||||
|
|
||||||
/* Auth Team */
|
/* Auth Team */
|
||||||
|
|||||||
@ -112,7 +112,8 @@ public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Orga
|
|||||||
AllowAdminAccessToAllCollectionItems = e.AllowAdminAccessToAllCollectionItems,
|
AllowAdminAccessToAllCollectionItems = e.AllowAdminAccessToAllCollectionItems,
|
||||||
UseRiskInsights = e.UseRiskInsights,
|
UseRiskInsights = e.UseRiskInsights,
|
||||||
UseOrganizationDomains = e.UseOrganizationDomains,
|
UseOrganizationDomains = e.UseOrganizationDomains,
|
||||||
UseAdminSponsoredFamilies = e.UseAdminSponsoredFamilies
|
UseAdminSponsoredFamilies = e.UseAdminSponsoredFamilies,
|
||||||
|
UseAutomaticUserConfirmation = e.UseAutomaticUserConfirmation
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,11 +376,6 @@ public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Orga
|
|||||||
return await query.ToArrayAsync();
|
return await query.ToArrayAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task EnableCollectionEnhancements(Guid organizationId)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException("Collection enhancements migration is not yet supported for Entity Framework.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<OrganizationSeatCounts> GetOccupiedSeatCountByOrganizationIdAsync(Guid organizationId)
|
public async Task<OrganizationSeatCounts> GetOccupiedSeatCountByOrganizationIdAsync(Guid organizationId)
|
||||||
{
|
{
|
||||||
using (var scope = ServiceScopeFactory.CreateScope())
|
using (var scope = ServiceScopeFactory.CreateScope())
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public class ProviderUserOrganizationDetailsViewQuery : IQuery<ProviderUserOrgan
|
|||||||
ProviderType = x.p.Type,
|
ProviderType = x.p.Type,
|
||||||
UseOrganizationDomains = x.o.UseOrganizationDomains,
|
UseOrganizationDomains = x.o.UseOrganizationDomains,
|
||||||
UseAdminSponsoredFamilies = x.o.UseAdminSponsoredFamilies,
|
UseAdminSponsoredFamilies = x.o.UseAdminSponsoredFamilies,
|
||||||
|
UseAutomaticUserConfirmation = x.o.UseAutomaticUserConfirmation
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,8 @@ CREATE PROCEDURE [dbo].[Organization_Create]
|
|||||||
@LimitItemDeletion BIT = 0,
|
@LimitItemDeletion BIT = 0,
|
||||||
@UseOrganizationDomains BIT = 0,
|
@UseOrganizationDomains BIT = 0,
|
||||||
@UseAdminSponsoredFamilies BIT = 0,
|
@UseAdminSponsoredFamilies BIT = 0,
|
||||||
@SyncSeats BIT = 0
|
@SyncSeats BIT = 0,
|
||||||
|
@UseAutomaticUserConfirmation BIT = 0
|
||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NOCOUNT ON
|
SET NOCOUNT ON
|
||||||
@ -124,69 +125,71 @@ BEGIN
|
|||||||
[LimitItemDeletion],
|
[LimitItemDeletion],
|
||||||
[UseOrganizationDomains],
|
[UseOrganizationDomains],
|
||||||
[UseAdminSponsoredFamilies],
|
[UseAdminSponsoredFamilies],
|
||||||
[SyncSeats]
|
[SyncSeats],
|
||||||
|
[UseAutomaticUserConfirmation]
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
@Id,
|
@Id,
|
||||||
@Identifier,
|
@Identifier,
|
||||||
@Name,
|
@Name,
|
||||||
@BusinessName,
|
@BusinessName,
|
||||||
@BusinessAddress1,
|
@BusinessAddress1,
|
||||||
@BusinessAddress2,
|
@BusinessAddress2,
|
||||||
@BusinessAddress3,
|
@BusinessAddress3,
|
||||||
@BusinessCountry,
|
@BusinessCountry,
|
||||||
@BusinessTaxNumber,
|
@BusinessTaxNumber,
|
||||||
@BillingEmail,
|
@BillingEmail,
|
||||||
@Plan,
|
@Plan,
|
||||||
@PlanType,
|
@PlanType,
|
||||||
@Seats,
|
@Seats,
|
||||||
@MaxCollections,
|
@MaxCollections,
|
||||||
@UsePolicies,
|
@UsePolicies,
|
||||||
@UseSso,
|
@UseSso,
|
||||||
@UseGroups,
|
@UseGroups,
|
||||||
@UseDirectory,
|
@UseDirectory,
|
||||||
@UseEvents,
|
@UseEvents,
|
||||||
@UseTotp,
|
@UseTotp,
|
||||||
@Use2fa,
|
@Use2fa,
|
||||||
@UseApi,
|
@UseApi,
|
||||||
@UseResetPassword,
|
@UseResetPassword,
|
||||||
@SelfHost,
|
@SelfHost,
|
||||||
@UsersGetPremium,
|
@UsersGetPremium,
|
||||||
@Storage,
|
@Storage,
|
||||||
@MaxStorageGb,
|
@MaxStorageGb,
|
||||||
@Gateway,
|
@Gateway,
|
||||||
@GatewayCustomerId,
|
@GatewayCustomerId,
|
||||||
@GatewaySubscriptionId,
|
@GatewaySubscriptionId,
|
||||||
@ReferenceData,
|
@ReferenceData,
|
||||||
@Enabled,
|
@Enabled,
|
||||||
@LicenseKey,
|
@LicenseKey,
|
||||||
@PublicKey,
|
@PublicKey,
|
||||||
@PrivateKey,
|
@PrivateKey,
|
||||||
@TwoFactorProviders,
|
@TwoFactorProviders,
|
||||||
@ExpirationDate,
|
@ExpirationDate,
|
||||||
@CreationDate,
|
@CreationDate,
|
||||||
@RevisionDate,
|
@RevisionDate,
|
||||||
@OwnersNotifiedOfAutoscaling,
|
@OwnersNotifiedOfAutoscaling,
|
||||||
@MaxAutoscaleSeats,
|
@MaxAutoscaleSeats,
|
||||||
@UseKeyConnector,
|
@UseKeyConnector,
|
||||||
@UseScim,
|
@UseScim,
|
||||||
@UseCustomPermissions,
|
@UseCustomPermissions,
|
||||||
@UseSecretsManager,
|
@UseSecretsManager,
|
||||||
@Status,
|
@Status,
|
||||||
@UsePasswordManager,
|
@UsePasswordManager,
|
||||||
@SmSeats,
|
@SmSeats,
|
||||||
@SmServiceAccounts,
|
@SmServiceAccounts,
|
||||||
@MaxAutoscaleSmSeats,
|
@MaxAutoscaleSmSeats,
|
||||||
@MaxAutoscaleSmServiceAccounts,
|
@MaxAutoscaleSmServiceAccounts,
|
||||||
@SecretsManagerBeta,
|
@SecretsManagerBeta,
|
||||||
@LimitCollectionCreation,
|
@LimitCollectionCreation,
|
||||||
@LimitCollectionDeletion,
|
@LimitCollectionDeletion,
|
||||||
@AllowAdminAccessToAllCollectionItems,
|
@AllowAdminAccessToAllCollectionItems,
|
||||||
@UseRiskInsights,
|
@UseRiskInsights,
|
||||||
@LimitItemDeletion,
|
@LimitItemDeletion,
|
||||||
@UseOrganizationDomains,
|
@UseOrganizationDomains,
|
||||||
@UseAdminSponsoredFamilies,
|
@UseAdminSponsoredFamilies,
|
||||||
@SyncSeats
|
@SyncSeats,
|
||||||
)
|
@UseAutomaticUserConfirmation
|
||||||
|
);
|
||||||
END
|
END
|
||||||
|
|||||||
@ -27,7 +27,8 @@ BEGIN
|
|||||||
[UseRiskInsights],
|
[UseRiskInsights],
|
||||||
[LimitItemDeletion],
|
[LimitItemDeletion],
|
||||||
[UseOrganizationDomains],
|
[UseOrganizationDomains],
|
||||||
[UseAdminSponsoredFamilies]
|
[UseAdminSponsoredFamilies],
|
||||||
|
[UseAutomaticUserConfirmation]
|
||||||
FROM
|
FROM
|
||||||
[dbo].[Organization]
|
[dbo].[Organization]
|
||||||
END
|
END
|
||||||
|
|||||||
@ -58,7 +58,8 @@ CREATE PROCEDURE [dbo].[Organization_Update]
|
|||||||
@LimitItemDeletion BIT = 0,
|
@LimitItemDeletion BIT = 0,
|
||||||
@UseOrganizationDomains BIT = 0,
|
@UseOrganizationDomains BIT = 0,
|
||||||
@UseAdminSponsoredFamilies BIT = 0,
|
@UseAdminSponsoredFamilies BIT = 0,
|
||||||
@SyncSeats BIT = 0
|
@SyncSeats BIT = 0,
|
||||||
|
@UseAutomaticUserConfirmation BIT = 0
|
||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NOCOUNT ON
|
SET NOCOUNT ON
|
||||||
@ -124,7 +125,8 @@ BEGIN
|
|||||||
[LimitItemDeletion] = @LimitItemDeletion,
|
[LimitItemDeletion] = @LimitItemDeletion,
|
||||||
[UseOrganizationDomains] = @UseOrganizationDomains,
|
[UseOrganizationDomains] = @UseOrganizationDomains,
|
||||||
[UseAdminSponsoredFamilies] = @UseAdminSponsoredFamilies,
|
[UseAdminSponsoredFamilies] = @UseAdminSponsoredFamilies,
|
||||||
[SyncSeats] = @SyncSeats
|
[SyncSeats] = @SyncSeats,
|
||||||
|
[UseAutomaticUserConfirmation] = @UseAutomaticUserConfirmation
|
||||||
WHERE
|
WHERE
|
||||||
[Id] = @Id
|
[Id] = @Id;
|
||||||
END
|
END
|
||||||
|
|||||||
@ -59,6 +59,7 @@ CREATE TABLE [dbo].[Organization] (
|
|||||||
[UseOrganizationDomains] BIT NOT NULL CONSTRAINT [DF_Organization_UseOrganizationDomains] DEFAULT (0),
|
[UseOrganizationDomains] BIT NOT NULL CONSTRAINT [DF_Organization_UseOrganizationDomains] DEFAULT (0),
|
||||||
[UseAdminSponsoredFamilies] BIT NOT NULL CONSTRAINT [DF_Organization_UseAdminSponsoredFamilies] DEFAULT (0),
|
[UseAdminSponsoredFamilies] BIT NOT NULL CONSTRAINT [DF_Organization_UseAdminSponsoredFamilies] DEFAULT (0),
|
||||||
[SyncSeats] BIT NOT NULL CONSTRAINT [DF_Organization_SyncSeats] DEFAULT (0),
|
[SyncSeats] BIT NOT NULL CONSTRAINT [DF_Organization_SyncSeats] DEFAULT (0),
|
||||||
|
[UseAutomaticUserConfirmation] BIT NOT NULL CONSTRAINT [DF_Organization_UseAutomaticUserConfirmation] DEFAULT (0),
|
||||||
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC)
|
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,8 @@ SELECT
|
|||||||
O.[LimitItemDeletion],
|
O.[LimitItemDeletion],
|
||||||
O.[UseAdminSponsoredFamilies],
|
O.[UseAdminSponsoredFamilies],
|
||||||
O.[UseOrganizationDomains],
|
O.[UseOrganizationDomains],
|
||||||
OS.[IsAdminInitiated]
|
OS.[IsAdminInitiated],
|
||||||
|
O.[UseAutomaticUserConfirmation]
|
||||||
FROM
|
FROM
|
||||||
[dbo].[OrganizationUser] OU
|
[dbo].[OrganizationUser] OU
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
|||||||
@ -39,7 +39,8 @@ SELECT
|
|||||||
O.[UseAdminSponsoredFamilies],
|
O.[UseAdminSponsoredFamilies],
|
||||||
P.[Type] ProviderType,
|
P.[Type] ProviderType,
|
||||||
O.[LimitItemDeletion],
|
O.[LimitItemDeletion],
|
||||||
O.[UseOrganizationDomains]
|
O.[UseOrganizationDomains],
|
||||||
|
O.[UseAutomaticUserConfirmation]
|
||||||
FROM
|
FROM
|
||||||
[dbo].[ProviderUser] PU
|
[dbo].[ProviderUser] PU
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Bit.Admin.AdminConsole.Controllers;
|
using Bit.Admin.AdminConsole.Controllers;
|
||||||
using Bit.Admin.AdminConsole.Models;
|
using Bit.Admin.AdminConsole.Models;
|
||||||
|
using Bit.Admin.Enums;
|
||||||
|
using Bit.Admin.Services;
|
||||||
using Bit.Core.AdminConsole.Entities;
|
using Bit.Core.AdminConsole.Entities;
|
||||||
using Bit.Core.AdminConsole.Entities.Provider;
|
using Bit.Core.AdminConsole.Entities.Provider;
|
||||||
using Bit.Core.AdminConsole.Enums.Provider;
|
using Bit.Core.AdminConsole.Enums.Provider;
|
||||||
@ -276,5 +278,40 @@ public class OrganizationsControllerTests
|
|||||||
await providerBillingService.Received(1).ScaleSeats(provider, update.PlanType!.Value, update.Seats!.Value - organization.Seats.Value + organization.Seats.Value);
|
await providerBillingService.Received(1).ScaleSeats(provider, update.PlanType!.Value, update.Seats!.Value - organization.Seats.Value + organization.Seats.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BitAutoData]
|
||||||
|
[SutProviderCustomize]
|
||||||
|
[Theory]
|
||||||
|
public async Task Edit_UseAutomaticUserConfirmation_FullUpdate_SavesFeatureCorrectly(
|
||||||
|
Organization organization,
|
||||||
|
SutProvider<OrganizationsController> sutProvider)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var update = new OrganizationEditModel
|
||||||
|
{
|
||||||
|
PlanType = PlanType.TeamsMonthly,
|
||||||
|
UseAutomaticUserConfirmation = true
|
||||||
|
};
|
||||||
|
|
||||||
|
organization.UseAutomaticUserConfirmation = false;
|
||||||
|
|
||||||
|
sutProvider.GetDependency<IAccessControlService>()
|
||||||
|
.UserHasPermission(Permission.Org_Plan_Edit)
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
var organizationRepository = sutProvider.GetDependency<IOrganizationRepository>();
|
||||||
|
|
||||||
|
organizationRepository.GetByIdAsync(organization.Id).Returns(organization);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_ = await sutProvider.Sut.Edit(organization.Id, update);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await organizationRepository.Received(1).ReplaceAsync(Arg.Is<Organization>(o => o.Id == organization.Id
|
||||||
|
&& o.UseAutomaticUserConfirmation == true));
|
||||||
|
|
||||||
|
// Annul
|
||||||
|
await organizationRepository.DeleteAsync(organization);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public class UpdateOrganizationLicenseCommandTests
|
|||||||
"Hash", "Signature", "SignatureBytes", "InstallationId", "Expires",
|
"Hash", "Signature", "SignatureBytes", "InstallationId", "Expires",
|
||||||
"ExpirationWithoutGracePeriod", "Token", "LimitCollectionCreationDeletion",
|
"ExpirationWithoutGracePeriod", "Token", "LimitCollectionCreationDeletion",
|
||||||
"LimitCollectionCreation", "LimitCollectionDeletion", "AllowAdminAccessToAllCollectionItems",
|
"LimitCollectionCreation", "LimitCollectionDeletion", "AllowAdminAccessToAllCollectionItems",
|
||||||
"UseOrganizationDomains", "UseAdminSponsoredFamilies") &&
|
"UseOrganizationDomains", "UseAdminSponsoredFamilies", "UseAutomaticUserConfirmation") &&
|
||||||
// Same property but different name, use explicit mapping
|
// Same property but different name, use explicit mapping
|
||||||
org.ExpirationDate == license.Expires));
|
org.ExpirationDate == license.Expires));
|
||||||
}
|
}
|
||||||
|
|||||||
509
util/Migrator/DbScripts/2025-10-07_00_AddAutoConfirmUser.sql
Normal file
509
util/Migrator/DbScripts/2025-10-07_00_AddAutoConfirmUser.sql
Normal file
@ -0,0 +1,509 @@
|
|||||||
|
-- Add AutomaticallyConfirmUsers column to Organization table
|
||||||
|
IF COL_LENGTH('[dbo].[Organization]', 'UseAutomaticUserConfirmation') IS NULL
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE [dbo].[Organization]
|
||||||
|
ADD [UseAutomaticUserConfirmation] BIT NOT NULL CONSTRAINT [DF_Organization_UseAutomaticUserConfirmation] DEFAULT (0);
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
-- Update Organization_Create stored procedure
|
||||||
|
CREATE OR ALTER PROCEDURE [dbo].[Organization_Create]
|
||||||
|
@Id UNIQUEIDENTIFIER OUTPUT,
|
||||||
|
@Identifier NVARCHAR(50),
|
||||||
|
@Name NVARCHAR(50),
|
||||||
|
@BusinessName NVARCHAR(50),
|
||||||
|
@BusinessAddress1 NVARCHAR(50),
|
||||||
|
@BusinessAddress2 NVARCHAR(50),
|
||||||
|
@BusinessAddress3 NVARCHAR(50),
|
||||||
|
@BusinessCountry VARCHAR(2),
|
||||||
|
@BusinessTaxNumber NVARCHAR(30),
|
||||||
|
@BillingEmail NVARCHAR(256),
|
||||||
|
@Plan NVARCHAR(50),
|
||||||
|
@PlanType TINYINT,
|
||||||
|
@Seats INT,
|
||||||
|
@MaxCollections SMALLINT,
|
||||||
|
@UsePolicies BIT,
|
||||||
|
@UseSso BIT,
|
||||||
|
@UseGroups BIT,
|
||||||
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
|
@UseTotp BIT,
|
||||||
|
@Use2fa BIT,
|
||||||
|
@UseApi BIT,
|
||||||
|
@UseResetPassword BIT,
|
||||||
|
@SelfHost BIT,
|
||||||
|
@UsersGetPremium BIT,
|
||||||
|
@Storage BIGINT,
|
||||||
|
@MaxStorageGb SMALLINT,
|
||||||
|
@Gateway TINYINT,
|
||||||
|
@GatewayCustomerId VARCHAR(50),
|
||||||
|
@GatewaySubscriptionId VARCHAR(50),
|
||||||
|
@ReferenceData VARCHAR(MAX),
|
||||||
|
@Enabled BIT,
|
||||||
|
@LicenseKey VARCHAR(100),
|
||||||
|
@PublicKey VARCHAR(MAX),
|
||||||
|
@PrivateKey VARCHAR(MAX),
|
||||||
|
@TwoFactorProviders NVARCHAR(MAX),
|
||||||
|
@ExpirationDate DATETIME2(7),
|
||||||
|
@CreationDate DATETIME2(7),
|
||||||
|
@RevisionDate DATETIME2(7),
|
||||||
|
@OwnersNotifiedOfAutoscaling DATETIME2(7),
|
||||||
|
@MaxAutoscaleSeats INT,
|
||||||
|
@UseKeyConnector BIT = 0,
|
||||||
|
@UseScim BIT = 0,
|
||||||
|
@UseCustomPermissions BIT = 0,
|
||||||
|
@UseSecretsManager BIT = 0,
|
||||||
|
@Status TINYINT = 0,
|
||||||
|
@UsePasswordManager BIT = 1,
|
||||||
|
@SmSeats INT = null,
|
||||||
|
@SmServiceAccounts INT = null,
|
||||||
|
@MaxAutoscaleSmSeats INT= null,
|
||||||
|
@MaxAutoscaleSmServiceAccounts INT = null,
|
||||||
|
@SecretsManagerBeta BIT = 0,
|
||||||
|
@LimitCollectionCreation BIT = NULL,
|
||||||
|
@LimitCollectionDeletion BIT = NULL,
|
||||||
|
@AllowAdminAccessToAllCollectionItems BIT = 0,
|
||||||
|
@UseRiskInsights BIT = 0,
|
||||||
|
@LimitItemDeletion BIT = 0,
|
||||||
|
@UseOrganizationDomains BIT = 0,
|
||||||
|
@UseAdminSponsoredFamilies BIT = 0,
|
||||||
|
@SyncSeats BIT = 0,
|
||||||
|
@UseAutomaticUserConfirmation BIT = 0
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
INSERT INTO [dbo].[Organization]
|
||||||
|
(
|
||||||
|
[Id],
|
||||||
|
[Identifier],
|
||||||
|
[Name],
|
||||||
|
[BusinessName],
|
||||||
|
[BusinessAddress1],
|
||||||
|
[BusinessAddress2],
|
||||||
|
[BusinessAddress3],
|
||||||
|
[BusinessCountry],
|
||||||
|
[BusinessTaxNumber],
|
||||||
|
[BillingEmail],
|
||||||
|
[Plan],
|
||||||
|
[PlanType],
|
||||||
|
[Seats],
|
||||||
|
[MaxCollections],
|
||||||
|
[UsePolicies],
|
||||||
|
[UseSso],
|
||||||
|
[UseGroups],
|
||||||
|
[UseDirectory],
|
||||||
|
[UseEvents],
|
||||||
|
[UseTotp],
|
||||||
|
[Use2fa],
|
||||||
|
[UseApi],
|
||||||
|
[UseResetPassword],
|
||||||
|
[SelfHost],
|
||||||
|
[UsersGetPremium],
|
||||||
|
[Storage],
|
||||||
|
[MaxStorageGb],
|
||||||
|
[Gateway],
|
||||||
|
[GatewayCustomerId],
|
||||||
|
[GatewaySubscriptionId],
|
||||||
|
[ReferenceData],
|
||||||
|
[Enabled],
|
||||||
|
[LicenseKey],
|
||||||
|
[PublicKey],
|
||||||
|
[PrivateKey],
|
||||||
|
[TwoFactorProviders],
|
||||||
|
[ExpirationDate],
|
||||||
|
[CreationDate],
|
||||||
|
[RevisionDate],
|
||||||
|
[OwnersNotifiedOfAutoscaling],
|
||||||
|
[MaxAutoscaleSeats],
|
||||||
|
[UseKeyConnector],
|
||||||
|
[UseScim],
|
||||||
|
[UseCustomPermissions],
|
||||||
|
[UseSecretsManager],
|
||||||
|
[Status],
|
||||||
|
[UsePasswordManager],
|
||||||
|
[SmSeats],
|
||||||
|
[SmServiceAccounts],
|
||||||
|
[MaxAutoscaleSmSeats],
|
||||||
|
[MaxAutoscaleSmServiceAccounts],
|
||||||
|
[SecretsManagerBeta],
|
||||||
|
[LimitCollectionCreation],
|
||||||
|
[LimitCollectionDeletion],
|
||||||
|
[AllowAdminAccessToAllCollectionItems],
|
||||||
|
[UseRiskInsights],
|
||||||
|
[LimitItemDeletion],
|
||||||
|
[UseOrganizationDomains],
|
||||||
|
[UseAdminSponsoredFamilies],
|
||||||
|
[SyncSeats],
|
||||||
|
[UseAutomaticUserConfirmation]
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@Id,
|
||||||
|
@Identifier,
|
||||||
|
@Name,
|
||||||
|
@BusinessName,
|
||||||
|
@BusinessAddress1,
|
||||||
|
@BusinessAddress2,
|
||||||
|
@BusinessAddress3,
|
||||||
|
@BusinessCountry,
|
||||||
|
@BusinessTaxNumber,
|
||||||
|
@BillingEmail,
|
||||||
|
@Plan,
|
||||||
|
@PlanType,
|
||||||
|
@Seats,
|
||||||
|
@MaxCollections,
|
||||||
|
@UsePolicies,
|
||||||
|
@UseSso,
|
||||||
|
@UseGroups,
|
||||||
|
@UseDirectory,
|
||||||
|
@UseEvents,
|
||||||
|
@UseTotp,
|
||||||
|
@Use2fa,
|
||||||
|
@UseApi,
|
||||||
|
@UseResetPassword,
|
||||||
|
@SelfHost,
|
||||||
|
@UsersGetPremium,
|
||||||
|
@Storage,
|
||||||
|
@MaxStorageGb,
|
||||||
|
@Gateway,
|
||||||
|
@GatewayCustomerId,
|
||||||
|
@GatewaySubscriptionId,
|
||||||
|
@ReferenceData,
|
||||||
|
@Enabled,
|
||||||
|
@LicenseKey,
|
||||||
|
@PublicKey,
|
||||||
|
@PrivateKey,
|
||||||
|
@TwoFactorProviders,
|
||||||
|
@ExpirationDate,
|
||||||
|
@CreationDate,
|
||||||
|
@RevisionDate,
|
||||||
|
@OwnersNotifiedOfAutoscaling,
|
||||||
|
@MaxAutoscaleSeats,
|
||||||
|
@UseKeyConnector,
|
||||||
|
@UseScim,
|
||||||
|
@UseCustomPermissions,
|
||||||
|
@UseSecretsManager,
|
||||||
|
@Status,
|
||||||
|
@UsePasswordManager,
|
||||||
|
@SmSeats,
|
||||||
|
@SmServiceAccounts,
|
||||||
|
@MaxAutoscaleSmSeats,
|
||||||
|
@MaxAutoscaleSmServiceAccounts,
|
||||||
|
@SecretsManagerBeta,
|
||||||
|
@LimitCollectionCreation,
|
||||||
|
@LimitCollectionDeletion,
|
||||||
|
@AllowAdminAccessToAllCollectionItems,
|
||||||
|
@UseRiskInsights,
|
||||||
|
@LimitItemDeletion,
|
||||||
|
@UseOrganizationDomains,
|
||||||
|
@UseAdminSponsoredFamilies,
|
||||||
|
@SyncSeats,
|
||||||
|
@UseAutomaticUserConfirmation
|
||||||
|
);
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
-- Update Organization_Update stored procedure
|
||||||
|
CREATE OR ALTER PROCEDURE [dbo].[Organization_Update]
|
||||||
|
@Id UNIQUEIDENTIFIER,
|
||||||
|
@Identifier NVARCHAR(50),
|
||||||
|
@Name NVARCHAR(50),
|
||||||
|
@BusinessName NVARCHAR(50),
|
||||||
|
@BusinessAddress1 NVARCHAR(50),
|
||||||
|
@BusinessAddress2 NVARCHAR(50),
|
||||||
|
@BusinessAddress3 NVARCHAR(50),
|
||||||
|
@BusinessCountry VARCHAR(2),
|
||||||
|
@BusinessTaxNumber NVARCHAR(30),
|
||||||
|
@BillingEmail NVARCHAR(256),
|
||||||
|
@Plan NVARCHAR(50),
|
||||||
|
@PlanType TINYINT,
|
||||||
|
@Seats INT,
|
||||||
|
@MaxCollections SMALLINT,
|
||||||
|
@UsePolicies BIT,
|
||||||
|
@UseSso BIT,
|
||||||
|
@UseGroups BIT,
|
||||||
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
|
@UseTotp BIT,
|
||||||
|
@Use2fa BIT,
|
||||||
|
@UseApi BIT,
|
||||||
|
@UseResetPassword BIT,
|
||||||
|
@SelfHost BIT,
|
||||||
|
@UsersGetPremium BIT,
|
||||||
|
@Storage BIGINT,
|
||||||
|
@MaxStorageGb SMALLINT,
|
||||||
|
@Gateway TINYINT,
|
||||||
|
@GatewayCustomerId VARCHAR(50),
|
||||||
|
@GatewaySubscriptionId VARCHAR(50),
|
||||||
|
@ReferenceData VARCHAR(MAX),
|
||||||
|
@Enabled BIT,
|
||||||
|
@LicenseKey VARCHAR(100),
|
||||||
|
@PublicKey VARCHAR(MAX),
|
||||||
|
@PrivateKey VARCHAR(MAX),
|
||||||
|
@TwoFactorProviders NVARCHAR(MAX),
|
||||||
|
@ExpirationDate DATETIME2(7),
|
||||||
|
@CreationDate DATETIME2(7),
|
||||||
|
@RevisionDate DATETIME2(7),
|
||||||
|
@OwnersNotifiedOfAutoscaling DATETIME2(7),
|
||||||
|
@MaxAutoscaleSeats INT,
|
||||||
|
@UseKeyConnector BIT = 0,
|
||||||
|
@UseScim BIT = 0,
|
||||||
|
@UseCustomPermissions BIT = 0,
|
||||||
|
@UseSecretsManager BIT = 0,
|
||||||
|
@Status TINYINT = 0,
|
||||||
|
@UsePasswordManager BIT = 1,
|
||||||
|
@SmSeats INT = null,
|
||||||
|
@SmServiceAccounts INT = null,
|
||||||
|
@MaxAutoscaleSmSeats INT = null,
|
||||||
|
@MaxAutoscaleSmServiceAccounts INT = null,
|
||||||
|
@SecretsManagerBeta BIT = 0,
|
||||||
|
@LimitCollectionCreation BIT = null,
|
||||||
|
@LimitCollectionDeletion BIT = null,
|
||||||
|
@AllowAdminAccessToAllCollectionItems BIT = 0,
|
||||||
|
@UseRiskInsights BIT = 0,
|
||||||
|
@LimitItemDeletion BIT = 0,
|
||||||
|
@UseOrganizationDomains BIT = 0,
|
||||||
|
@UseAdminSponsoredFamilies BIT = 0,
|
||||||
|
@SyncSeats BIT = 0,
|
||||||
|
@UseAutomaticUserConfirmation BIT = 0
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[dbo].[Organization]
|
||||||
|
SET
|
||||||
|
[Identifier] = @Identifier,
|
||||||
|
[Name] = @Name,
|
||||||
|
[BusinessName] = @BusinessName,
|
||||||
|
[BusinessAddress1] = @BusinessAddress1,
|
||||||
|
[BusinessAddress2] = @BusinessAddress2,
|
||||||
|
[BusinessAddress3] = @BusinessAddress3,
|
||||||
|
[BusinessCountry] = @BusinessCountry,
|
||||||
|
[BusinessTaxNumber] = @BusinessTaxNumber,
|
||||||
|
[BillingEmail] = @BillingEmail,
|
||||||
|
[Plan] = @Plan,
|
||||||
|
[PlanType] = @PlanType,
|
||||||
|
[Seats] = @Seats,
|
||||||
|
[MaxCollections] = @MaxCollections,
|
||||||
|
[UsePolicies] = @UsePolicies,
|
||||||
|
[UseSso] = @UseSso,
|
||||||
|
[UseGroups] = @UseGroups,
|
||||||
|
[UseDirectory] = @UseDirectory,
|
||||||
|
[UseEvents] = @UseEvents,
|
||||||
|
[UseTotp] = @UseTotp,
|
||||||
|
[Use2fa] = @Use2fa,
|
||||||
|
[UseApi] = @UseApi,
|
||||||
|
[UseResetPassword] = @UseResetPassword,
|
||||||
|
[SelfHost] = @SelfHost,
|
||||||
|
[UsersGetPremium] = @UsersGetPremium,
|
||||||
|
[Storage] = @Storage,
|
||||||
|
[MaxStorageGb] = @MaxStorageGb,
|
||||||
|
[Gateway] = @Gateway,
|
||||||
|
[GatewayCustomerId] = @GatewayCustomerId,
|
||||||
|
[GatewaySubscriptionId] = @GatewaySubscriptionId,
|
||||||
|
[ReferenceData] = @ReferenceData,
|
||||||
|
[Enabled] = @Enabled,
|
||||||
|
[LicenseKey] = @LicenseKey,
|
||||||
|
[PublicKey] = @PublicKey,
|
||||||
|
[PrivateKey] = @PrivateKey,
|
||||||
|
[TwoFactorProviders] = @TwoFactorProviders,
|
||||||
|
[ExpirationDate] = @ExpirationDate,
|
||||||
|
[CreationDate] = @CreationDate,
|
||||||
|
[RevisionDate] = @RevisionDate,
|
||||||
|
[OwnersNotifiedOfAutoscaling] = @OwnersNotifiedOfAutoscaling,
|
||||||
|
[MaxAutoscaleSeats] = @MaxAutoscaleSeats,
|
||||||
|
[UseKeyConnector] = @UseKeyConnector,
|
||||||
|
[UseScim] = @UseScim,
|
||||||
|
[UseCustomPermissions] = @UseCustomPermissions,
|
||||||
|
[UseSecretsManager] = @UseSecretsManager,
|
||||||
|
[Status] = @Status,
|
||||||
|
[UsePasswordManager] = @UsePasswordManager,
|
||||||
|
[SmSeats] = @SmSeats,
|
||||||
|
[SmServiceAccounts] = @SmServiceAccounts,
|
||||||
|
[MaxAutoscaleSmSeats] = @MaxAutoscaleSmSeats,
|
||||||
|
[MaxAutoscaleSmServiceAccounts] = @MaxAutoscaleSmServiceAccounts,
|
||||||
|
[SecretsManagerBeta] = @SecretsManagerBeta,
|
||||||
|
[LimitCollectionCreation] = @LimitCollectionCreation,
|
||||||
|
[LimitCollectionDeletion] = @LimitCollectionDeletion,
|
||||||
|
[AllowAdminAccessToAllCollectionItems] = @AllowAdminAccessToAllCollectionItems,
|
||||||
|
[UseRiskInsights] = @UseRiskInsights,
|
||||||
|
[LimitItemDeletion] = @LimitItemDeletion,
|
||||||
|
[UseOrganizationDomains] = @UseOrganizationDomains,
|
||||||
|
[UseAdminSponsoredFamilies] = @UseAdminSponsoredFamilies,
|
||||||
|
[SyncSeats] = @SyncSeats,
|
||||||
|
[UseAutomaticUserConfirmation] = @UseAutomaticUserConfirmation
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id;
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE OR ALTER PROCEDURE [dbo].[Organization_ReadAbilities]
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
[Id],
|
||||||
|
[UseEvents],
|
||||||
|
[Use2fa],
|
||||||
|
CASE
|
||||||
|
WHEN [Use2fa] = 1 AND [TwoFactorProviders] IS NOT NULL AND [TwoFactorProviders] != '{}' THEN
|
||||||
|
1
|
||||||
|
ELSE
|
||||||
|
0
|
||||||
|
END AS [Using2fa],
|
||||||
|
[UsersGetPremium],
|
||||||
|
[UseCustomPermissions],
|
||||||
|
[UseSso],
|
||||||
|
[UseKeyConnector],
|
||||||
|
[UseScim],
|
||||||
|
[UseResetPassword],
|
||||||
|
[UsePolicies],
|
||||||
|
[Enabled],
|
||||||
|
[LimitCollectionCreation],
|
||||||
|
[LimitCollectionDeletion],
|
||||||
|
[AllowAdminAccessToAllCollectionItems],
|
||||||
|
[UseRiskInsights],
|
||||||
|
[LimitItemDeletion],
|
||||||
|
[UseOrganizationDomains],
|
||||||
|
[UseAdminSponsoredFamilies],
|
||||||
|
[UseAutomaticUserConfirmation]
|
||||||
|
FROM
|
||||||
|
[dbo].[Organization]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE OR ALTER VIEW [dbo].[OrganizationUserOrganizationDetailsView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
OU.[UserId],
|
||||||
|
OU.[OrganizationId],
|
||||||
|
OU.[Id] OrganizationUserId,
|
||||||
|
O.[Name],
|
||||||
|
O.[Enabled],
|
||||||
|
O.[PlanType],
|
||||||
|
O.[UsePolicies],
|
||||||
|
O.[UseSso],
|
||||||
|
O.[UseKeyConnector],
|
||||||
|
O.[UseScim],
|
||||||
|
O.[UseGroups],
|
||||||
|
O.[UseDirectory],
|
||||||
|
O.[UseEvents],
|
||||||
|
O.[UseTotp],
|
||||||
|
O.[Use2fa],
|
||||||
|
O.[UseApi],
|
||||||
|
O.[UseResetPassword],
|
||||||
|
O.[SelfHost],
|
||||||
|
O.[UsersGetPremium],
|
||||||
|
O.[UseCustomPermissions],
|
||||||
|
O.[UseSecretsManager],
|
||||||
|
O.[Seats],
|
||||||
|
O.[MaxCollections],
|
||||||
|
O.[MaxStorageGb],
|
||||||
|
O.[Identifier],
|
||||||
|
OU.[Key],
|
||||||
|
OU.[ResetPasswordKey],
|
||||||
|
O.[PublicKey],
|
||||||
|
O.[PrivateKey],
|
||||||
|
OU.[Status],
|
||||||
|
OU.[Type],
|
||||||
|
SU.[ExternalId] SsoExternalId,
|
||||||
|
OU.[Permissions],
|
||||||
|
PO.[ProviderId],
|
||||||
|
P.[Name] ProviderName,
|
||||||
|
P.[Type] ProviderType,
|
||||||
|
SS.[Enabled] SsoEnabled,
|
||||||
|
SS.[Data] SsoConfig,
|
||||||
|
OS.[FriendlyName] FamilySponsorshipFriendlyName,
|
||||||
|
OS.[LastSyncDate] FamilySponsorshipLastSyncDate,
|
||||||
|
OS.[ToDelete] FamilySponsorshipToDelete,
|
||||||
|
OS.[ValidUntil] FamilySponsorshipValidUntil,
|
||||||
|
OU.[AccessSecretsManager],
|
||||||
|
O.[UsePasswordManager],
|
||||||
|
O.[SmSeats],
|
||||||
|
O.[SmServiceAccounts],
|
||||||
|
O.[LimitCollectionCreation],
|
||||||
|
O.[LimitCollectionDeletion],
|
||||||
|
O.[AllowAdminAccessToAllCollectionItems],
|
||||||
|
O.[UseRiskInsights],
|
||||||
|
O.[LimitItemDeletion],
|
||||||
|
O.[UseAdminSponsoredFamilies],
|
||||||
|
O.[UseOrganizationDomains],
|
||||||
|
OS.[IsAdminInitiated],
|
||||||
|
O.[UseAutomaticUserConfirmation]
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationUser] OU
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[Organization] O ON O.[Id] = OU.[OrganizationId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[SsoUser] SU ON SU.[UserId] = OU.[UserId] AND SU.[OrganizationId] = OU.[OrganizationId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[ProviderOrganization] PO ON PO.[OrganizationId] = O.[Id]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[Provider] P ON P.[Id] = PO.[ProviderId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[SsoConfig] SS ON SS.[OrganizationId] = OU.[OrganizationId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[OrganizationSponsorship] OS ON OS.[SponsoringOrganizationUserID] = OU.[Id]
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE OR ALTER VIEW [dbo].[ProviderUserProviderOrganizationDetailsView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
PU.[UserId],
|
||||||
|
PO.[OrganizationId],
|
||||||
|
O.[Name],
|
||||||
|
O.[Enabled],
|
||||||
|
O.[UsePolicies],
|
||||||
|
O.[UseSso],
|
||||||
|
O.[UseKeyConnector],
|
||||||
|
O.[UseScim],
|
||||||
|
O.[UseGroups],
|
||||||
|
O.[UseDirectory],
|
||||||
|
O.[UseEvents],
|
||||||
|
O.[UseTotp],
|
||||||
|
O.[Use2fa],
|
||||||
|
O.[UseApi],
|
||||||
|
O.[UseResetPassword],
|
||||||
|
O.[SelfHost],
|
||||||
|
O.[UsersGetPremium],
|
||||||
|
O.[UseCustomPermissions],
|
||||||
|
O.[Seats],
|
||||||
|
O.[MaxCollections],
|
||||||
|
O.[MaxStorageGb],
|
||||||
|
O.[Identifier],
|
||||||
|
PO.[Key],
|
||||||
|
O.[PublicKey],
|
||||||
|
O.[PrivateKey],
|
||||||
|
PU.[Status],
|
||||||
|
PU.[Type],
|
||||||
|
PO.[ProviderId],
|
||||||
|
PU.[Id] ProviderUserId,
|
||||||
|
P.[Name] ProviderName,
|
||||||
|
O.[PlanType],
|
||||||
|
O.[LimitCollectionCreation],
|
||||||
|
O.[LimitCollectionDeletion],
|
||||||
|
O.[AllowAdminAccessToAllCollectionItems],
|
||||||
|
O.[UseRiskInsights],
|
||||||
|
O.[UseAdminSponsoredFamilies],
|
||||||
|
P.[Type] ProviderType,
|
||||||
|
O.[LimitItemDeletion],
|
||||||
|
O.[UseOrganizationDomains],
|
||||||
|
O.[UseAutomaticUserConfirmation]
|
||||||
|
FROM
|
||||||
|
[dbo].[ProviderUser] PU
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[ProviderOrganization] PO ON PO.[ProviderId] = PU.[ProviderId]
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[Organization] O ON O.[Id] = PO.[OrganizationId]
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[Provider] P ON P.[Id] = PU.[ProviderId]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_refreshview '[dbo].[OrganizationView]';
|
||||||
|
EXEC sp_refreshview '[dbo].[OrganizationCipherDetailsCollectionsView]';
|
||||||
|
EXEC sp_refreshview '[dbo].[ProviderOrganizationOrganizationDetailsView]';
|
||||||
|
GO
|
||||||
3287
util/MySqlMigrations/Migrations/20251010142240_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
3287
util/MySqlMigrations/Migrations/20251010142240_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Bit.MySqlMigrations.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddAutoConfirmUserToOrg : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -220,6 +220,9 @@ namespace Bit.MySqlMigrations.Migrations
|
|||||||
b.Property<bool>("UseApi")
|
b.Property<bool>("UseApi")
|
||||||
.HasColumnType("tinyint(1)");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("UseAutomaticUserConfirmation")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<bool>("UseCustomPermissions")
|
b.Property<bool>("UseCustomPermissions")
|
||||||
.HasColumnType("tinyint(1)");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
|||||||
3293
util/PostgresMigrations/Migrations/20251010142249_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
3293
util/PostgresMigrations/Migrations/20251010142249_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Bit.PostgresMigrations.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddAutoConfirmUserToOrg : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization",
|
||||||
|
type: "boolean",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -222,6 +222,9 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.Property<bool>("UseApi")
|
b.Property<bool>("UseApi")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("UseAutomaticUserConfirmation")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<bool>("UseCustomPermissions")
|
b.Property<bool>("UseCustomPermissions")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
|||||||
3276
util/SqliteMigrations/Migrations/20251010142244_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
3276
util/SqliteMigrations/Migrations/20251010142244_AddAutoConfirmUserToOrg.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Bit.SqliteMigrations.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddAutoConfirmUserToOrg : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "UseAutomaticUserConfirmation",
|
||||||
|
table: "Organization");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -215,6 +215,9 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.Property<bool>("UseApi")
|
b.Property<bool>("UseApi")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<bool>("UseAutomaticUserConfirmation")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<bool>("UseCustomPermissions")
|
b.Property<bool>("UseCustomPermissions")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user