1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

[Provider] Prevent including pending organizations in SyncResponse (#1482)

This commit is contained in:
Oscar Hinton 2021-07-22 22:18:34 +02:00 committed by GitHub
parent 757102fd96
commit 792fb377dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 4 deletions

View File

@ -14,5 +14,6 @@ namespace Bit.Core.Models.Data
public bool Enabled { get; set; }
public string Permissions { get; set; }
public bool UseEvents { get; set; }
public ProviderStatusType ProviderStatus { get; set; }
}
}

View File

@ -21,7 +21,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries
join p in dbContext.Providers
on pu.ProviderId equals p.Id into p_g
from p in p_g.DefaultIfEmpty()
where pu.UserId == _userId && (_status == null || pu.Status == _status)
where pu.UserId == _userId && p.Status != ProviderStatusType.Pending && (_status == null || pu.Status == _status)
select new { pu, p };
return query.Select(x => new ProviderUserProviderDetails()
{
@ -34,6 +34,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries
Enabled = x.p.Enabled,
Permissions = x.pu.Permissions,
UseEvents = x.p.UseEvents,
ProviderStatus = x.p.Status,
});
}
}

View File

@ -11,5 +11,6 @@ BEGIN
[dbo].[ProviderUserProviderDetailsView]
WHERE
[UserId] = @UserId
AND [ProviderStatus] != 0 -- Not Pending
AND (@Status IS NULL OR [Status] = @Status)
END

View File

@ -9,7 +9,8 @@ SELECT
PU.[Type],
P.[Enabled],
PU.[Permissions],
P.[UseEvents]
P.[UseEvents],
P.[Status] ProviderStatus
FROM
[dbo].[ProviderUser] PU
LEFT JOIN

View File

@ -950,7 +950,8 @@ SELECT
PU.[Type],
P.[Enabled],
PU.[Permissions],
P.[UseEvents]
P.[UseEvents],
P.[Status] ProviderStatus
FROM
[dbo].[ProviderUser] PU
LEFT JOIN
@ -976,6 +977,7 @@ BEGIN
[dbo].[ProviderUserProviderDetailsView]
WHERE
[UserId] = @UserId
AND [ProviderStatus] != 0 -- Not Pending
AND (@Status IS NULL OR [Status] = @Status)
END
GO