mirror of
https://github.com/bitwarden/server.git
synced 2025-04-07 05:58:13 -05:00
Add support for managing organizations through providers using the business portal (#1521)
This commit is contained in:
parent
f055df4e82
commit
bc003c4449
@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models.Data;
|
using Bit.Core.Models.Data;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
|
|
||||||
@ -70,6 +71,47 @@ namespace Bit.Portal
|
|||||||
Type = ou.Type
|
Type = ou.Type
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
// Add all provider orgs.
|
||||||
|
var providerOrgs = await GetProviderOrganizations();
|
||||||
|
Organizations.AddRange(providerOrgs.Select(po => new CurrentContentOrganization
|
||||||
|
{
|
||||||
|
Id = po.OrganizationId,
|
||||||
|
Type = OrganizationUserType.Owner,
|
||||||
|
}));
|
||||||
|
// Yes this is ugly, but the business portal is deprecated.
|
||||||
|
OrganizationsDetails.AddRange(providerOrgs.Select(pu => new OrganizationUserOrganizationDetails
|
||||||
|
{
|
||||||
|
OrganizationId = pu.OrganizationId,
|
||||||
|
UserId = pu.UserId,
|
||||||
|
Name = pu.Name,
|
||||||
|
UsePolicies = pu.UsePolicies,
|
||||||
|
UseSso = pu.UseSso,
|
||||||
|
UseGroups = pu.UseGroups,
|
||||||
|
UseDirectory = pu.UseDirectory,
|
||||||
|
UseEvents = pu.UseEvents,
|
||||||
|
UseTotp = pu.UseTotp,
|
||||||
|
Use2fa = pu.Use2fa,
|
||||||
|
UseApi = pu.UseApi,
|
||||||
|
UseResetPassword = pu.UseResetPassword,
|
||||||
|
SelfHost = pu.SelfHost,
|
||||||
|
UsersGetPremium = pu.UsersGetPremium,
|
||||||
|
Seats = pu.Seats,
|
||||||
|
MaxCollections = pu.MaxCollections,
|
||||||
|
MaxStorageGb = pu.MaxStorageGb,
|
||||||
|
Key = pu.Key,
|
||||||
|
Status = OrganizationUserStatusType.Confirmed,
|
||||||
|
Type = OrganizationUserType.Owner,
|
||||||
|
Enabled = pu.Enabled,
|
||||||
|
SsoExternalId = null,
|
||||||
|
Identifier = pu.Identifier,
|
||||||
|
Permissions = null,
|
||||||
|
ResetPasswordKey = null,
|
||||||
|
PublicKey = pu.PublicKey,
|
||||||
|
PrivateKey = pu.PrivateKey,
|
||||||
|
ProviderId = pu.ProviderId,
|
||||||
|
ProviderName = pu.ProviderName,
|
||||||
|
}));
|
||||||
|
|
||||||
if (SelectedOrganizationId == null && HttpContext.Request.Cookies.ContainsKey("SelectedOrganization") &&
|
if (SelectedOrganizationId == null && HttpContext.Request.Cookies.ContainsKey("SelectedOrganization") &&
|
||||||
Guid.TryParse(HttpContext.Request.Cookies["SelectedOrganization"], out var selectedOrgId))
|
Guid.TryParse(HttpContext.Request.Cookies["SelectedOrganization"], out var selectedOrgId))
|
||||||
{
|
{
|
||||||
|
@ -441,7 +441,7 @@ namespace Bit.Core.Context
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<ProviderUserOrganizationDetails>> GetProviderOrganizations()
|
protected async Task<IEnumerable<ProviderUserOrganizationDetails>> GetProviderOrganizations()
|
||||||
{
|
{
|
||||||
if (_providerUserOrganizations == null)
|
if (_providerUserOrganizations == null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user