Browse Source

added a status check to the read by minimum role proc (#1498)

pull/1505/head
Addison Beck 4 years ago committed by GitHub
parent
commit
b726b08ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs
  2. 1
      src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql
  3. 1
      util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql

4
src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs

@ -397,7 +397,9 @@ namespace Bit.Core.Repositories.EntityFramework @@ -397,7 +397,9 @@ namespace Bit.Core.Repositories.EntityFramework
var dbContext = GetDatabaseContext(scope);
var query = dbContext.OrganizationUsers
.Include(e => e.User)
.Where(e => e.OrganizationId.Equals(organizationId) && e.Type <= minRole)
.Where(e => e.OrganizationId.Equals(organizationId) &&
e.Type <= minRole &&
e.Status == OrganizationUserStatusType.Confirmed)
.Select(e => new OrganizationUserUserDetails() {
Id = e.Id,
Email = e.Email ?? e.User.Email

1
src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql

@ -11,5 +11,6 @@ BEGIN @@ -11,5 +11,6 @@ BEGIN
[dbo].[OrganizationUserUserDetailsView]
WHERE
OrganizationId = @OrganizationId
AND Status = 2 -- 2 = Confirmed
AND [Type] <= @MinRole
END

1
util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql

@ -17,5 +17,6 @@ BEGIN @@ -17,5 +17,6 @@ BEGIN
[dbo].[OrganizationUserUserDetailsView]
WHERE
OrganizationId = @OrganizationId
AND Status = 2
AND [Type] <= @MinRole
END

Loading…
Cancel
Save