mirror of
https://github.com/bitwarden/server.git
synced 2025-05-20 11:04:31 -05:00
Defect/SG-825 - users in org w/ no personal vault still see personal vault (disabled org policies now still apply) (#2429)
* 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
This commit is contained in:
parent
9ce6ee443b
commit
a791f93051
@ -74,13 +74,13 @@ public class SyncController : Controller
|
|||||||
|
|
||||||
IEnumerable<CollectionDetails> collections = null;
|
IEnumerable<CollectionDetails> collections = null;
|
||||||
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null;
|
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null;
|
||||||
IEnumerable<Policy> policies = null;
|
IEnumerable<Policy> policies = await _policyRepository.GetManyByUserIdAsync(user.Id);
|
||||||
|
|
||||||
if (hasEnabledOrgs)
|
if (hasEnabledOrgs)
|
||||||
{
|
{
|
||||||
collections = await _collectionRepository.GetManyByUserIdAsync(user.Id);
|
collections = await _collectionRepository.GetManyByUserIdAsync(user.Id);
|
||||||
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdAsync(user.Id);
|
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdAsync(user.Id);
|
||||||
collectionCiphersGroupDict = collectionCiphers.GroupBy(c => c.CipherId).ToDictionary(s => s.Key);
|
collectionCiphersGroupDict = collectionCiphers.GroupBy(c => c.CipherId).ToDictionary(s => s.Key);
|
||||||
policies = await _policyRepository.GetManyByUserIdAsync(user.Id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var userTwoFactorEnabled = await _userService.TwoFactorIsEnabledAsync(user);
|
var userTwoFactorEnabled = await _userService.TwoFactorIsEnabledAsync(user);
|
||||||
|
@ -20,8 +20,7 @@ public class PolicyReadByUserIdQuery : IQuery<Policy>
|
|||||||
join o in dbContext.Organizations
|
join o in dbContext.Organizations
|
||||||
on ou.OrganizationId equals o.Id
|
on ou.OrganizationId equals o.Id
|
||||||
where ou.UserId == _userId &&
|
where ou.UserId == _userId &&
|
||||||
ou.Status == OrganizationUserStatusType.Confirmed &&
|
ou.Status == OrganizationUserStatusType.Confirmed
|
||||||
o.Enabled == true
|
|
||||||
select p;
|
select p;
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
@ -15,5 +15,4 @@ BEGIN
|
|||||||
WHERE
|
WHERE
|
||||||
OU.[UserId] = @UserId
|
OU.[UserId] = @UserId
|
||||||
AND OU.[Status] = 2 -- 2 = Confirmed
|
AND OU.[Status] = 2 -- 2 = Confirmed
|
||||||
AND O.[Enabled] = 1
|
|
||||||
END
|
END
|
@ -0,0 +1,24 @@
|
|||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[Policy_ReadByUserId]
|
||||||
|
@UserId UNIQUEIDENTIFIER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
P.*
|
||||||
|
FROM
|
||||||
|
[dbo].[PolicyView] P
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[OrganizationUser] OU ON P.[OrganizationId] = OU.[OrganizationId]
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[Organization] O ON OU.[OrganizationId] = O.[Id]
|
||||||
|
WHERE
|
||||||
|
OU.[UserId] = @UserId
|
||||||
|
AND OU.[Status] = 2 -- 2 = Confirmed
|
||||||
|
END
|
||||||
|
GO
|
Loading…
x
Reference in New Issue
Block a user