mirror of
https://github.com/bitwarden/server.git
synced 2026-02-02 23:23:15 +08:00
* scim project stub * some scim models and v2 controllers * implement some v2 scim endpoints * fix spacing * api key auth * EC-261 - SCIM Org API Key and connection type config * EC-261 - Fix lint errors/formatting * updates for okta implementation testing * fix var ref * updates from testing with Okta * implement scim context via provider parsing * support single and list of ids for add/remove groups * log ops not handled * touch up scim context * group list filtering * EC-261 - Additional SCIM provider types * EC-265 - UseScim flag and license update * EC-265 - SCIM provider type of default (0) * EC-265 - Add Scim URL and update connection validation * EC-265 - Model validation and cleanup for SCIM keys * implement scim org connection * EC-265 - Ensure ServiceUrl is not persisted to DB * EC-265 - Exclude provider type from DB if not configured * EC-261 - EF Migrations for SCIM * add docker builds for scim * EC-261 - Fix failing permissions tests * EC-261 - Fix unit tests and pgsql migrations * Formatting fixes from linter * EC-265 - Remove service URL from scim config * EC-265 - Fix unit tests, removed wayward validation * EC-265 - Require self-hosted for billing sync org conn * EC-265 - Fix formatting issues - whitespace * EC-261 - PR feedback and cleanup * scim constants rename * no scim settings right now * update project name * delete package lock * update appsettings configs for scim * use default scim provider for context Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
63 lines
3.0 KiB
C#
63 lines
3.0 KiB
C#
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
|
|
|
|
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries
|
|
{
|
|
public class OrganizationUserOrganizationDetailsViewQuery : IQuery<OrganizationUserOrganizationDetails>
|
|
{
|
|
public IQueryable<OrganizationUserOrganizationDetails> Run(DatabaseContext dbContext)
|
|
{
|
|
var query = from ou in dbContext.OrganizationUsers
|
|
join o in dbContext.Organizations on ou.OrganizationId equals o.Id
|
|
join su in dbContext.SsoUsers on ou.UserId equals su.UserId into su_g
|
|
from su in su_g.DefaultIfEmpty()
|
|
join po in dbContext.ProviderOrganizations on o.Id equals po.OrganizationId into po_g
|
|
from po in po_g.DefaultIfEmpty()
|
|
join p in dbContext.Providers on po.ProviderId equals p.Id into p_g
|
|
from p in p_g.DefaultIfEmpty()
|
|
join os in dbContext.OrganizationSponsorships on ou.Id equals os.SponsoringOrganizationUserId into os_g
|
|
from os in os_g.DefaultIfEmpty()
|
|
join ss in dbContext.SsoConfigs on ou.OrganizationId equals ss.OrganizationId into ss_g
|
|
from ss in ss_g.DefaultIfEmpty()
|
|
where ((su == null || !su.OrganizationId.HasValue) || su.OrganizationId == ou.OrganizationId)
|
|
select new { ou, o, su, p, ss, os };
|
|
|
|
return query.Select(x => new OrganizationUserOrganizationDetails
|
|
{
|
|
OrganizationId = x.ou.OrganizationId,
|
|
UserId = x.ou.UserId,
|
|
Name = x.o.Name,
|
|
Enabled = x.o.Enabled,
|
|
PlanType = x.o.PlanType,
|
|
UsePolicies = x.o.UsePolicies,
|
|
UseSso = x.o.UseSso,
|
|
UseKeyConnector = x.o.UseKeyConnector,
|
|
UseScim = x.o.UseScim,
|
|
UseGroups = x.o.UseGroups,
|
|
UseDirectory = x.o.UseDirectory,
|
|
UseEvents = x.o.UseEvents,
|
|
UseTotp = x.o.UseTotp,
|
|
Use2fa = x.o.Use2fa,
|
|
UseApi = x.o.UseApi,
|
|
SelfHost = x.o.SelfHost,
|
|
UsersGetPremium = x.o.UsersGetPremium,
|
|
Seats = x.o.Seats,
|
|
MaxCollections = x.o.MaxCollections,
|
|
MaxStorageGb = x.o.MaxStorageGb,
|
|
Identifier = x.o.Identifier,
|
|
Key = x.ou.Key,
|
|
ResetPasswordKey = x.ou.ResetPasswordKey,
|
|
Status = x.ou.Status,
|
|
Type = x.ou.Type,
|
|
SsoExternalId = x.su.ExternalId,
|
|
Permissions = x.ou.Permissions,
|
|
PublicKey = x.o.PublicKey,
|
|
PrivateKey = x.o.PrivateKey,
|
|
ProviderId = x.p.Id,
|
|
ProviderName = x.p.Name,
|
|
FamilySponsorshipFriendlyName = x.os.FriendlyName,
|
|
SsoConfig = x.ss.Data,
|
|
});
|
|
}
|
|
}
|
|
}
|