diff --git a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs index 7ce9928372..82bf012b04 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs @@ -50,8 +50,10 @@ public class SecretRepository : Repository c.OrganizationId == organizationId && c.DeletedDate == null); - query.Include(c => c.Projects); + IQueryable query = dbContext.Secret + .Where(c => c.OrganizationId == organizationId && c.DeletedDate == null) + .Include(c => c.Projects); + query = accessType switch { AccessClientType.NoAccessCheck => query, @@ -129,7 +131,8 @@ public class SecretRepository : Repository s.Projects.Any(p => p.Id == projectId) && s.DeletedDate == null) - .Include(s => s.Projects); + .Include(s => s.Projects) + ; var secrets = SecretToPermissionDetails(query, userId, accessType);