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 14087ddffa..7ce9928372 100644 --- a/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs +++ b/bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/SecretRepository.cs @@ -25,8 +25,8 @@ public class SecretRepository : Repository c.Id == id && c.DeletedDate == null) + .Include("Projects") .FirstOrDefaultAsync(); return Mapper.Map(secret); } @@ -50,10 +50,8 @@ public class SecretRepository : Repository c.Projects) - .Where(c => c.OrganizationId == organizationId && c.DeletedDate == null); - + var query = dbContext.Secret.Where(c => c.OrganizationId == organizationId && c.DeletedDate == null); + query.Include(c => c.Projects); query = accessType switch { AccessClientType.NoAccessCheck => query, @@ -71,8 +69,8 @@ public class SecretRepository : Repository c.Projects) .Where(c => c.OrganizationId == organizationId && c.DeletedDate == null) + .Include(c => c.Projects) .OrderBy(s => s.RevisionDate); var secrets = SecretToPermissionDetails(query, userId, accessType); @@ -130,8 +128,8 @@ public class SecretRepository : Repository s.Projects) - .Where(s => s.Projects.Any(p => p.Id == projectId) && s.DeletedDate == null); + var query = dbContext.Secret.Where(s => s.Projects.Any(p => p.Id == projectId) && s.DeletedDate == null) + .Include(s => s.Projects); var secrets = SecretToPermissionDetails(query, userId, accessType);