diff --git a/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs b/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs index 52f67a2de1..eca35b6b96 100644 --- a/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs +++ b/src/Core/Repositories/EntityFramework/OrganizationUserRepository.cs @@ -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 diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql index cd5889d6e5..3162174769 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_ReadByMinimumRole.sql @@ -11,5 +11,6 @@ BEGIN [dbo].[OrganizationUserUserDetailsView] WHERE OrganizationId = @OrganizationId + AND Status = 2 -- 2 = Confirmed AND [Type] <= @MinRole END diff --git a/util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql b/util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql index 77779ec59a..e5f22420f2 100644 --- a/util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql +++ b/util/Migrator/DbScripts/2021-07-15_00_OrganizationUserReadByMinimumRole.sql @@ -17,5 +17,6 @@ BEGIN [dbo].[OrganizationUserUserDetailsView] WHERE OrganizationId = @OrganizationId + AND Status = 2 AND [Type] <= @MinRole END