mirror of
https://github.com/bitwarden/server.git
synced 2026-02-01 06:33:17 +08:00
* SG-825 - Policy_ReadByUserId stored proc now pulls back policies of disabled orgs * SG-825 - SyncController - Always retrieve policies -- even if orgs are disabled. * SG-825 - EF - PolicyReadByUserId - autoformat to remove whitespace and pass eslint build error
29 lines
862 B
C#
29 lines
862 B
C#
using Bit.Core.Enums;
|
|
using Bit.Infrastructure.EntityFramework.Models;
|
|
|
|
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
|
|
|
public class PolicyReadByUserIdQuery : IQuery<Policy>
|
|
{
|
|
private readonly Guid _userId;
|
|
|
|
public PolicyReadByUserIdQuery(Guid userId)
|
|
{
|
|
_userId = userId;
|
|
}
|
|
|
|
public IQueryable<Policy> Run(DatabaseContext dbContext)
|
|
{
|
|
var query = from p in dbContext.Policies
|
|
join ou in dbContext.OrganizationUsers
|
|
on p.OrganizationId equals ou.OrganizationId
|
|
join o in dbContext.Organizations
|
|
on ou.OrganizationId equals o.Id
|
|
where ou.UserId == _userId &&
|
|
ou.Status == OrganizationUserStatusType.Confirmed
|
|
select p;
|
|
|
|
return query;
|
|
}
|
|
}
|