diff --git a/src/Microsoft.Health.Abstractions/Microsoft.Health.Abstractions.csproj b/src/Microsoft.Health.Abstractions/Microsoft.Health.Abstractions.csproj index b0e5c4625a..6b1045a469 100644 --- a/src/Microsoft.Health.Abstractions/Microsoft.Health.Abstractions.csproj +++ b/src/Microsoft.Health.Abstractions/Microsoft.Health.Abstractions.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Microsoft.Health.ControlPlane.Core/Features/Rbac/Role.cs b/src/Microsoft.Health.ControlPlane.Core/Features/Rbac/Role.cs index 391fc8d7df..a89226775e 100644 --- a/src/Microsoft.Health.ControlPlane.Core/Features/Rbac/Role.cs +++ b/src/Microsoft.Health.ControlPlane.Core/Features/Rbac/Role.cs @@ -40,6 +40,7 @@ internal Role(string name, IList resourcePermissions, string [JsonProperty("etag")] public virtual string VersionTag { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO class")] [JsonProperty("resourcePermissions")] public virtual IList ResourcePermissions { get; set; } = new List(); diff --git a/src/Microsoft.Health.ControlPlane.Core/Microsoft.Health.ControlPlane.Core.csproj b/src/Microsoft.Health.ControlPlane.Core/Microsoft.Health.ControlPlane.Core.csproj index b9709846d7..65dcc991e8 100644 --- a/src/Microsoft.Health.ControlPlane.Core/Microsoft.Health.ControlPlane.Core.csproj +++ b/src/Microsoft.Health.ControlPlane.Core/Microsoft.Health.ControlPlane.Core.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Microsoft.Health.ControlPlane.CosmosDb/Microsoft.Health.ControlPlane.CosmosDb.csproj b/src/Microsoft.Health.ControlPlane.CosmosDb/Microsoft.Health.ControlPlane.CosmosDb.csproj index 1a08031ff1..e5a0987b92 100644 --- a/src/Microsoft.Health.ControlPlane.CosmosDb/Microsoft.Health.ControlPlane.CosmosDb.csproj +++ b/src/Microsoft.Health.ControlPlane.CosmosDb/Microsoft.Health.ControlPlane.CosmosDb.csproj @@ -22,7 +22,7 @@ - + diff --git a/src/Microsoft.Health.CosmosDb/Configs/CosmosDataStoreConfiguration.cs b/src/Microsoft.Health.CosmosDb/Configs/CosmosDataStoreConfiguration.cs index 9efe23a5f7..447ac2b4cd 100644 --- a/src/Microsoft.Health.CosmosDb/Configs/CosmosDataStoreConfiguration.cs +++ b/src/Microsoft.Health.CosmosDb/Configs/CosmosDataStoreConfiguration.cs @@ -30,6 +30,7 @@ public class CosmosDataStoreConfiguration public Uri RelativeDatabaseUri => string.IsNullOrEmpty(DatabaseId) ? null : UriFactory.CreateDatabaseUri(DatabaseId); + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a configuration class")] public IList PreferredLocations { get; set; } public int DataMigrationBatchSize { get; set; } = 100; diff --git a/src/Microsoft.Health.CosmosDb/Microsoft.Health.CosmosDb.csproj b/src/Microsoft.Health.CosmosDb/Microsoft.Health.CosmosDb.csproj index d3278b0563..18af5fac80 100644 --- a/src/Microsoft.Health.CosmosDb/Microsoft.Health.CosmosDb.csproj +++ b/src/Microsoft.Health.CosmosDb/Microsoft.Health.CosmosDb.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Microsoft.Health.Extensions.DependencyInjection/Microsoft.Health.Extensions.DependencyInjection.csproj b/src/Microsoft.Health.Extensions.DependencyInjection/Microsoft.Health.Extensions.DependencyInjection.csproj index d57ad45563..7e544415a9 100644 --- a/src/Microsoft.Health.Extensions.DependencyInjection/Microsoft.Health.Extensions.DependencyInjection.csproj +++ b/src/Microsoft.Health.Extensions.DependencyInjection/Microsoft.Health.Extensions.DependencyInjection.csproj @@ -11,9 +11,9 @@ - + - + diff --git a/src/Microsoft.Health.Fhir.Api/Microsoft.Health.Fhir.Api.csproj b/src/Microsoft.Health.Fhir.Api/Microsoft.Health.Fhir.Api.csproj index d5171b5d14..a2447f3369 100644 --- a/src/Microsoft.Health.Fhir.Api/Microsoft.Health.Fhir.Api.csproj +++ b/src/Microsoft.Health.Fhir.Api/Microsoft.Health.Fhir.Api.csproj @@ -25,11 +25,11 @@ - + - + diff --git a/src/Microsoft.Health.Fhir.Core.UnitTests/Features/Security/RoleBasedAuthorizationPolicyUnitTests.cs b/src/Microsoft.Health.Fhir.Core.UnitTests/Features/Security/RoleBasedAuthorizationPolicyUnitTests.cs index c1ae587838..6e4bce205d 100644 --- a/src/Microsoft.Health.Fhir.Core.UnitTests/Features/Security/RoleBasedAuthorizationPolicyUnitTests.cs +++ b/src/Microsoft.Health.Fhir.Core.UnitTests/Features/Security/RoleBasedAuthorizationPolicyUnitTests.cs @@ -94,12 +94,14 @@ private static AuthorizationConfiguration GetAuthorizationConfigurationForRoles( new ResourcePermission(resourceActions), }; - var roles = roleNames.Select(ra => GetRole(ra, permissions)).ToList(); + var authConfiguration = new AuthorizationConfiguration(); - return new AuthorizationConfiguration + foreach (var name in roleNames) { - Roles = roles, - }; + authConfiguration.Roles.Add(GetRole(name, permissions)); + } + + return authConfiguration; } private static Role GetRole(string name, IList resourcePermissions) diff --git a/src/Microsoft.Health.Fhir.Core/Configs/AuthorizationConfiguration.cs b/src/Microsoft.Health.Fhir.Core/Configs/AuthorizationConfiguration.cs index 6dd48a7231..1cea47cbc9 100644 --- a/src/Microsoft.Health.Fhir.Core/Configs/AuthorizationConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Core/Configs/AuthorizationConfiguration.cs @@ -17,7 +17,7 @@ public class AuthorizationConfiguration public bool Enabled { get; set; } - public IList Roles { get; set; } = new List(); + public IList Roles { get; } = new List(); public void ValidateRoles() { diff --git a/src/Microsoft.Health.Fhir.Core/Configs/SecurityConfiguration.cs b/src/Microsoft.Health.Fhir.Core/Configs/SecurityConfiguration.cs index 9806b9140f..62a1d7e0d9 100644 --- a/src/Microsoft.Health.Fhir.Core/Configs/SecurityConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Core/Configs/SecurityConfiguration.cs @@ -15,7 +15,7 @@ public class SecurityConfiguration public AuthenticationConfiguration Authentication { get; set; } = new AuthenticationConfiguration(); - public virtual HashSet LastModifiedClaims { get; set; } = new HashSet(); + public virtual HashSet LastModifiedClaims { get; } = new HashSet(); public AuthorizationConfiguration Authorization { get; set; } = new AuthorizationConfiguration(); } diff --git a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedCapabilityStatement.cs b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedCapabilityStatement.cs index 6ec63c9bd1..05b770ba13 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedCapabilityStatement.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedCapabilityStatement.cs @@ -10,6 +10,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Conformance { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO-style class")] public sealed class ListedCapabilityStatement { public Uri Url { get; set; } diff --git a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedResourceComponent.cs b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedResourceComponent.cs index 9121851cc3..1167b544c1 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedResourceComponent.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedResourceComponent.cs @@ -9,6 +9,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Conformance { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO-style class")] public class ListedResourceComponent { public ListedResourceComponent() diff --git a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedRestComponent.cs b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedRestComponent.cs index 8bc78429a1..fcf305f493 100644 --- a/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedRestComponent.cs +++ b/src/Microsoft.Health.Fhir.Core/Features/Conformance/ListedRestComponent.cs @@ -8,21 +8,21 @@ namespace Microsoft.Health.Fhir.Core.Features.Conformance { - public class ListedRestComponent - { - public string Documentation { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is a DTO-style class")] + public class ListedRestComponent + { + public string Documentation { get; set; } - public IList Mode { get; set; } + public IList Mode { get; set; } - public IList Resource { get; set; } + public IList Resource { get; set; } - public SecurityComponent Security { get; set; } + public SecurityComponent Security { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "This is currently set in code")] - public List Interaction { get; set; } + public List Interaction { get; set; } - public IList SearchParam { get; set; } + public IList SearchParam { get; set; } - public IList Operation { get; set; } - } + public IList Operation { get; set; } + } } diff --git a/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj b/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj index 23782d9936..caa2b15a5b 100644 --- a/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj +++ b/src/Microsoft.Health.Fhir.Core/Microsoft.Health.Fhir.Core.csproj @@ -22,11 +22,11 @@ - + - + diff --git a/src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj b/src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj index 006ff1ca4b..51c281a0bf 100644 --- a/src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj +++ b/src/Microsoft.Health.Fhir.CosmosDb/Microsoft.Health.Fhir.CosmosDb.csproj @@ -16,9 +16,9 @@ - + - + diff --git a/src/Microsoft.Health.Fhir.Tests.Common/Microsoft.Health.Fhir.Tests.Common.csproj b/src/Microsoft.Health.Fhir.Tests.Common/Microsoft.Health.Fhir.Tests.Common.csproj index 032833c61a..9d5bd32f10 100644 --- a/src/Microsoft.Health.Fhir.Tests.Common/Microsoft.Health.Fhir.Tests.Common.csproj +++ b/src/Microsoft.Health.Fhir.Tests.Common/Microsoft.Health.Fhir.Tests.Common.csproj @@ -98,7 +98,7 @@ - + diff --git a/src/Microsoft.Health.Fhir.ValueSets/Microsoft.Health.Fhir.ValueSets.csproj b/src/Microsoft.Health.Fhir.ValueSets/Microsoft.Health.Fhir.ValueSets.csproj index aac1aa46b3..8c66fa6292 100644 --- a/src/Microsoft.Health.Fhir.ValueSets/Microsoft.Health.Fhir.ValueSets.csproj +++ b/src/Microsoft.Health.Fhir.ValueSets/Microsoft.Health.Fhir.ValueSets.csproj @@ -14,9 +14,9 @@ - + - + diff --git a/src/Microsoft.Health.Fhir.Web/DevelopmentIdentityProviderApplicationConfiguration.cs b/src/Microsoft.Health.Fhir.Web/DevelopmentIdentityProviderApplicationConfiguration.cs index fe5d878806..a6d4bf9b00 100644 --- a/src/Microsoft.Health.Fhir.Web/DevelopmentIdentityProviderApplicationConfiguration.cs +++ b/src/Microsoft.Health.Fhir.Web/DevelopmentIdentityProviderApplicationConfiguration.cs @@ -11,6 +11,6 @@ public class DevelopmentIdentityProviderApplicationConfiguration { public string Id { get; set; } - public IList Roles { get; set; } = new List(); + public IList Roles { get; } = new List(); } } diff --git a/src/Microsoft.Health.Fhir.Web/Microsoft.Health.Fhir.Web.csproj b/src/Microsoft.Health.Fhir.Web/Microsoft.Health.Fhir.Web.csproj index e347aca48a..2018156ae0 100644 --- a/src/Microsoft.Health.Fhir.Web/Microsoft.Health.Fhir.Web.csproj +++ b/src/Microsoft.Health.Fhir.Web/Microsoft.Health.Fhir.Web.csproj @@ -15,10 +15,10 @@ - + - +