From 73a97912a2c32a9f77ea286a8bdc8fb80a460a3b Mon Sep 17 00:00:00 2001 From: Geoff McElhanon Date: Wed, 31 Jul 2024 06:29:36 -0500 Subject: [PATCH] [ODS-6425] Support extensibility for read request authorization filtering based on custom database views (#1106) --- .../Container/Modules/ExtensionsModule.cs | 15 +- Application/EdFi.Ods.Api/EdFi.Ods.Api.csproj | 2 +- .../AuthorizationBasisMetadataSelector.cs | 69 +- .../Pipeline/SetAuthorizationContext.cs | 1 + ...regateRootCriteriaProviderDecoratorBase.cs | 39 +- .../Repositories/EntityAuthorizer.cs | 2 +- .../Authorization/ResourceClaimUriProvider.cs | 93 +- .../AuthorizationStrategyNameAttribute.cs | 24 + ...edAuthorizationFilterDefinitionsFactory.cs | 228 ++++ ...mViewBasedAuthorizationStrategyProvider.cs | 40 + .../CustomViewBasisEntityProvider.cs | 58 + .../ICustomViewBasisEntityProvider.cs | 16 + .../IAuthorizationStrategyProvider.cs | 13 + .../NamedAuthorizationStrategyProvider.cs | 25 + ...edAuthorizationFilterDefinitionsFactory.cs | 21 +- .../NamespaceBasedAuthorizationStrategy.cs | 1 + ...horizationRequiredAuthorizationStrategy.cs | 1 + ...edAuthorizationFilterDefinitionsFactory.cs | 13 +- .../OwnershipBasedAuthorizationStrategy.cs | 1 + .../Filters/ICriteriaExtensions.cs | 77 +- .../ViewBasedAuthorizationFilterDefinition.cs | 91 +- ...onshipsAuthorizationContextDataProvider.cs | 15 +- ...AuthorizationContextDataProviderFactory.cs | 5 +- ...AuthorizationContextDataProviderFactory.cs | 22 +- .../RelationshipsAuthorizationStrategyBase.cs | 28 +- ...izationStrategyFilterDefinitionsFactory.cs | 8 +- ...ithEdOrgsAndPeopleAuthorizationStrategy.cs | 13 +- ...leIncludingDeletesAuthorizationStrategy.cs | 13 +- ...izationStrategyFilterDefinitionsFactory.cs | 2 +- ...sAndPeopleInvertedAuthorizationStrategy.cs | 13 +- ...hipsWithEdOrgsOnlyAuthorizationStrategy.cs | 13 +- ...EdOrgsOnlyInvertedAuthorizationStrategy.cs | 13 +- ...hipsWithPeopleOnlyAuthorizationStrategy.cs | 13 +- ...psWithStudentsOnlyAuthorizationStrategy.cs | 13 +- ...oughResponsibilityAuthorizationStrategy.cs | 13 +- ...izationStrategyFilterDefinitionsFactory.cs | 2 +- ...tyIncludingDeletesAuthorizationStrategy.cs | 13 +- ...izationStrategyFilterDefinitionsFactory.cs | 4 +- .../Container/Modules/SecurityModule.cs | 75 +- .../EdFi.Ods.Api/Startup/OdsStartupBase.cs | 2 +- .../Caching/BytesExtensions.cs | 8 +- .../NHibernateConfigurationExtensions.cs | 2 +- .../AuthorizationFilterDefinition.cs | 5 +- .../AuthorizationFilterDefinitionProvider.cs | 41 +- .../IAuthorizationFilterDefinitionProvider.cs | 2 +- .../IAuthorizationFilterDefinitionsFactory.cs | 11 +- .../CreateDateBasedTransientInterceptor.cs | 28 - .../Interceptors/EdFiOdsInterceptor.cs | 69 + .../Models/Domain/EntityExtensions.cs | 4 +- .../Models/IResourceModelProvider.cs | 2 +- .../Models/ProfileResourceModelProvider.cs | 4 +- .../Models/Resource/ProfileResourceModel.cs | 8 +- .../Resource/ProfilesAppliedResourceModel.cs | 2 +- .../Models/Resource/ResourceModel.cs | 33 +- .../Models/Resource/ResourceModelProvider.cs | 2 +- .../Models/ResourceModelHelper.cs | 2 +- .../AuthorizationFilterContext.cs | 104 +- .../AuthorizationStrategyFiltering.cs | 2 + .../CustomViewBasedAuthorizationStrategy.cs | 105 ++ .../Authorization/IAuthorizationStrategy.cs | 4 - .../IResourceClaimUriProvider.cs | 10 +- .../CustomViewBased/CustomViewHelpers.cs | 58 + .../Controllers/DeletesController.cs | 2 +- .../Controllers/KeyChangesController.cs | 2 +- ...sAuthorizationContextDataProviderModule.cs | 8 +- ...ationContextDataProviderOverridesModule.cs | 12 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...ationContextDataProviderOverridesModule.cs | 16 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- ...onshipsAuthorizationContextDataProvider.cs | 11 +- .../AuthorizationBasisMetdataSelectorTests.cs | 15 +- .../ResourceClaimUriProviderTests.cs | 39 +- .../Models/Resource/ResourceChildItemTests.cs | 2 +- .../EdFiAuthorizationProviderTests.cs | 96 +- .../NamespaceBasedAuthorizationTests.cs | 4 +- .../CompositeAuthorizationDecoratorTests.cs | 2 +- ...RelationshipsAuthorizationStrategyTests.cs | 20 +- ...tionContextProviders.generated.approved.cs | 39 +- ...tionContextProviders.generated.approved.cs | 13 +- ...tionContextProviders.generated.approved.cs | 156 +-- ...tionContextProviders.generated.approved.cs | 1144 +++++++--------- ...tionContextProviders.generated.approved.cs | 39 +- ...tionContextProviders.generated.approved.cs | 13 +- ...tionContextProviders.generated.approved.cs | 156 +-- ...tionContextProviders.generated.approved.cs | 1210 ++++++++--------- .../EntityAuthorizationContextProviders.cs | 2 +- ...tityAuthorizationContextProviders.mustache | 15 +- 91 files changed, 2752 insertions(+), 1946 deletions(-) create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/AuthorizationStrategyNameAttribute.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationFilterDefinitionsFactory.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationStrategyProvider.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasisEntityProvider.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/ICustomViewBasisEntityProvider.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/IAuthorizationStrategyProvider.cs create mode 100644 Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamedAuthorizationStrategyProvider.cs delete mode 100644 Application/EdFi.Ods.Common/Infrastructure/Interceptors/CreateDateBasedTransientInterceptor.cs create mode 100644 Application/EdFi.Ods.Common/Infrastructure/Interceptors/EdFiOdsInterceptor.cs create mode 100644 Application/EdFi.Ods.Common/Security/Authorization/CustomViewBasedAuthorizationStrategy.cs rename Application/{EdFi.Ods.Api => EdFi.Ods.Common}/Security/Authorization/IResourceClaimUriProvider.cs (70%) create mode 100644 Application/EdFi.Ods.Common/Security/CustomViewBased/CustomViewHelpers.cs diff --git a/Application/EdFi.Ods.Api/Container/Modules/ExtensionsModule.cs b/Application/EdFi.Ods.Api/Container/Modules/ExtensionsModule.cs index b1613d520a..1dde11f9ea 100644 --- a/Application/EdFi.Ods.Api/Container/Modules/ExtensionsModule.cs +++ b/Application/EdFi.Ods.Api/Container/Modules/ExtensionsModule.cs @@ -64,27 +64,22 @@ public override void ApplyConfigurationSpecificRegistrations(ContainerBuilder bu var relationshipContextDataProviderTypes = assembly.GetTypes() .Where( - t => !t.IsAbstract && typeof(IRelationshipsAuthorizationContextDataProvider<,>).IsAssignableFromGeneric(t)) + t => !t.IsAbstract && typeof(IRelationshipsAuthorizationContextDataProvider<>).IsAssignableFromGeneric(t)) .ToList(); - var contextDataType = typeof(RelationshipsAuthorizationContextData); foreach (var providerType in relationshipContextDataProviderTypes) { var partiallyClosedInterfaceType = providerType.GetInterfaces() - .SingleOrDefault(i => i.Name == typeof(IRelationshipsAuthorizationContextDataProvider<,>).Name); + .SingleOrDefault(i => i.Name == typeof(IRelationshipsAuthorizationContextDataProvider<>).Name); var modelType = partiallyClosedInterfaceType?.GetGenericArguments()[0]; var closedInterfaceType = - typeof(IRelationshipsAuthorizationContextDataProvider<,>) - .MakeGenericType(modelType, contextDataType); + typeof(IRelationshipsAuthorizationContextDataProvider<>) + .MakeGenericType(modelType); - var closedServiceType = - providerType - .MakeGenericType(contextDataType); - - builder.RegisterType(closedServiceType).As(closedInterfaceType) + builder.RegisterType(providerType).As(closedInterfaceType) .SingleInstance(); } }); diff --git a/Application/EdFi.Ods.Api/EdFi.Ods.Api.csproj b/Application/EdFi.Ods.Api/EdFi.Ods.Api.csproj index 8992b22023..a717ca9ae8 100644 --- a/Application/EdFi.Ods.Api/EdFi.Ods.Api.csproj +++ b/Application/EdFi.Ods.Api/EdFi.Ods.Api.csproj @@ -1,4 +1,4 @@ - + EdFi.Suite3.Ods.Api LICENSE.txt diff --git a/Application/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetadataSelector.cs b/Application/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetadataSelector.cs index d1858a713b..09563cecfa 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetadataSelector.cs +++ b/Application/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetadataSelector.cs @@ -6,8 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; -using EdFi.Common.Extensions; -using EdFi.Ods.Api.Security.AuthorizationStrategies.NamespaceBased; +using EdFi.Ods.Api.Security.AuthorizationStrategies; using EdFi.Ods.Api.Security.Claims; using EdFi.Ods.Common.Exceptions; using EdFi.Ods.Common.Security.Authorization; @@ -23,27 +22,26 @@ public class AuthorizationBasisMetadataSelector : IAuthorizationBasisMetadataSel private readonly IResourceAuthorizationMetadataProvider _resourceAuthorizationMetadataProvider; private readonly IClaimSetClaimsProvider _claimSetClaimsProvider; - private readonly Dictionary _authorizationStrategyByName; + private readonly IAuthorizationStrategyProvider[] _authorizationStrategyProviders; private readonly Lazy> _bitValuesByAction; - private const string AuthorizationStrategyNameSuffix = "AuthorizationStrategy"; - /// /// Initializes a new instance of the class. /// /// The component that will be used to supply the claims/strategies that can be used to authorize the resource. /// - /// /// + /// public AuthorizationBasisMetadataSelector( IResourceAuthorizationMetadataProvider resourceAuthorizationMetadataProvider, ISecurityRepository securityRepository, - IAuthorizationStrategy[] authorizationStrategies, - IClaimSetClaimsProvider claimSetClaimsProvider) + IClaimSetClaimsProvider claimSetClaimsProvider, + IAuthorizationStrategyProvider[] authorizationStrategyProviders) { _resourceAuthorizationMetadataProvider = resourceAuthorizationMetadataProvider; _claimSetClaimsProvider = claimSetClaimsProvider; + _authorizationStrategyProviders = authorizationStrategyProviders; // Lazy initialization _bitValuesByAction = new Lazy>( @@ -55,44 +53,6 @@ public AuthorizationBasisMetadataSelector( { securityRepository.GetActionByName("Delete").ActionUri, 0x8 }, { securityRepository.GetActionByName("ReadChanges").ActionUri, 0x10 }, }); - - _authorizationStrategyByName = CreateAuthorizationStrategyByNameDictionary(); - - Dictionary CreateAuthorizationStrategyByNameDictionary() - { - var strategyByName = new Dictionary(StringComparer.OrdinalIgnoreCase); - - foreach (var strategy in authorizationStrategies) - { - string strategyTypeName = GetStrategyTypeName(strategy); - - // TODO: Embedded convention - // Enforce naming conventions on authorization strategies - if (!strategyTypeName.EndsWith(AuthorizationStrategyNameSuffix)) - { - throw new ArgumentException( - $"The authorization strategy '{strategyTypeName}' does not follow proper naming conventions, ending with '{AuthorizationStrategyNameSuffix}'."); - } - - string strategyName = strategyTypeName.TrimSuffix(AuthorizationStrategyNameSuffix); - strategyByName.Add(strategyName, strategy); - } - - return strategyByName; - } - - string GetStrategyTypeName(IAuthorizationStrategy strategy) - { - string rawTypeName = strategy.GetType().Name; - - int genericMarkerPos = rawTypeName.IndexOf('`'); - - string strategyTypeName = genericMarkerPos < 0 - ? rawTypeName - : rawTypeName.Substring(0, genericMarkerPos); - - return strategyTypeName; - } } /// @@ -135,7 +95,8 @@ public AuthorizationBasisMetadata SelectAuthorizationBasisMetadata( // No authorization strategies were defined for this request if (authorizationStrategyNames == null || !authorizationStrategyNames.Any()) { - throw new Exception( + throw new SecurityConfigurationException( + SecurityConfigurationException.DefaultDetail, string.Format( "No authorization strategies were defined for the requested action '{0}' against resource URIs ['{1}'] matched by the caller's claim '{2}'.", claimCheckResponse.RequestedAction, @@ -171,13 +132,19 @@ IReadOnlyList GetAuthorizationStrategies(IReadOnlyList { - if (!_authorizationStrategyByName.ContainsKey(strategyName)) + foreach (var authorizationStrategyProvider in _authorizationStrategyProviders) { - throw new Exception( - $"Could not find authorization implementation for strategy '{strategyName}' based on naming convention of '{{strategyName}}{AuthorizationStrategyNameSuffix}'."); + var authorizationStrategy = authorizationStrategyProvider.GetByName(strategyName); + + if (authorizationStrategy != null) + { + return authorizationStrategy; + } } - return _authorizationStrategyByName[strategyName]; + throw new SecurityConfigurationException( + SecurityConfigurationException.DefaultDetail, + $"Could not find an authorization strategy implementation for strategy name '{strategyName}'."); }) .ToArray(); } diff --git a/Application/EdFi.Ods.Api/Security/Authorization/Pipeline/SetAuthorizationContext.cs b/Application/EdFi.Ods.Api/Security/Authorization/Pipeline/SetAuthorizationContext.cs index a03513e6c5..85b27e4914 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/Pipeline/SetAuthorizationContext.cs +++ b/Application/EdFi.Ods.Api/Security/Authorization/Pipeline/SetAuthorizationContext.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using EdFi.Common; using EdFi.Ods.Common.Infrastructure.Pipelines; +using EdFi.Ods.Common.Security.Authorization; using EdFi.Ods.Common.Security.Claims; using EdFi.Security.DataAccess.Repositories; diff --git a/Application/EdFi.Ods.Api/Security/Authorization/Repositories/AggregateRootCriteriaProviderDecoratorBase.cs b/Application/EdFi.Ods.Api/Security/Authorization/Repositories/AggregateRootCriteriaProviderDecoratorBase.cs index 7ea5654a5a..dab53f3215 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/Repositories/AggregateRootCriteriaProviderDecoratorBase.cs +++ b/Application/EdFi.Ods.Api/Security/Authorization/Repositories/AggregateRootCriteriaProviderDecoratorBase.cs @@ -60,8 +60,8 @@ public ICriteria GetCriteriaQuery(TEntity specification, IQueryParameters queryP // Create the "OR" junction var mainDisjunction = new Disjunction(); - // If there are multiple authorization strategies with views, we must use left outer joins and null/not null checks - var joinType = DetermineJoinType(); + // If there are multiple relationship-based authorization strategies with views (that are combined with OR), we must use left outer joins and null/not null checks + var relationshipBasedAuthViewJoinType = DetermineRelationshipBasedAuthViewJoinType(); bool conjunctionFiltersWereApplied = ApplyAuthorizationStrategiesCombinedWithAndLogic(); bool disjunctionFiltersWereApplied = ApplyAuthorizationStrategiesCombinedWithOrLogic(); @@ -70,10 +70,11 @@ public ICriteria GetCriteriaQuery(TEntity specification, IQueryParameters queryP return criteria; - JoinType DetermineJoinType() + JoinType DetermineRelationshipBasedAuthViewJoinType() { - var countOfAuthorizationFiltersWithViewBasedFilters = authorizationFiltering.Count( - af => af.Filters.Select(afd => + // Relationship-based authorization filters are combined using OR, Custom auth-view filters are combined using AND + var countOfRelationshipBasedAuthorizationFilters = authorizationFiltering.Count( + af => af.Operator == FilterOperator.Or && af.Filters.Select(afd => { if (_authorizationFilterDefinitionProvider.TryGetAuthorizationFilterDefinition(afd.FilterName, out var filterDetails)) { @@ -88,7 +89,7 @@ JoinType DetermineJoinType() .OfType() .Any()); - return countOfAuthorizationFiltersWithViewBasedFilters > 1 + return countOfRelationshipBasedAuthorizationFilters > 1 ? JoinType.LeftOuterJoin : JoinType.InnerJoin; } @@ -102,7 +103,7 @@ bool ApplyAuthorizationStrategiesCombinedWithAndLogic() foreach (var andStrategy in andStrategies) { - if (!TryApplyFilters(mainConjunction, andStrategy.Filters)) + if (!TryApplyFilters(mainConjunction, andStrategy.Filters, andStrategy.AuthorizationStrategy, JoinType.InnerJoin)) { // All filters for AND strategies must be applied, and if not, this is an error condition throw new Exception($"The following authorization filters are not recognized: {string.Join(" ", unsupportedAuthorizationFilters)}"); @@ -125,7 +126,7 @@ bool ApplyAuthorizationStrategiesCombinedWithOrLogic() { var filtersConjunction = new Conjunction(); // Combine filters with 'AND' - if (TryApplyFilters(filtersConjunction, orStrategy.Filters)) + if (TryApplyFilters(filtersConjunction, orStrategy.Filters, orStrategy.AuthorizationStrategy, relationshipBasedAuthViewJoinType)) { mainDisjunction.Add(filtersConjunction); @@ -142,7 +143,11 @@ bool ApplyAuthorizationStrategiesCombinedWithOrLogic() return disjunctionFiltersApplied; } - bool TryApplyFilters(Conjunction conjunction, IReadOnlyList filters) + bool TryApplyFilters( + Conjunction conjunction, + IReadOnlyList filters, + IAuthorizationStrategy authorizationStrategy, + JoinType joinType) { bool allFiltersCanBeApplied = true; @@ -169,17 +174,17 @@ bool TryApplyFilters(Conjunction conjunction, IReadOnlyList - { - { filterContext.ClaimParameterName, filterContext.ClaimParameterValues } - }; + var parameterValues = filterContext.ClaimParameterName == null + ? new Dictionary() + : new Dictionary + { + { filterContext.ClaimParameterName, filterContext.ClaimParameterValues } + }; // Apply the authorization strategy filter - applicator(criteria, conjunction, filterContext.SubjectEndpointName, parameterValues, joinType); + filterDefinition.CriteriaApplicator(criteria, conjunction, filterContext.SubjectEndpointNames, parameterValues, joinType, authorizationStrategy); filtersApplied = true; } diff --git a/Application/EdFi.Ods.Api/Security/Authorization/Repositories/EntityAuthorizer.cs b/Application/EdFi.Ods.Api/Security/Authorization/Repositories/EntityAuthorizer.cs index b85ba3d196..19de82a28f 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/Repositories/EntityAuthorizer.cs +++ b/Application/EdFi.Ods.Api/Security/Authorization/Repositories/EntityAuthorizer.cs @@ -231,7 +231,7 @@ AuthorizationStrategyFilterResults[] PerformInstanceBasedAuthorization( .Select( f => new { - FilterDefinition = _authorizationFilterDefinitionProvider.GetFilterDefinition(f.FilterName), + FilterDefinition = _authorizationFilterDefinitionProvider.GetAuthorizationFilterDefinition(f.FilterName), FilterContext = f }) .Select( diff --git a/Application/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProvider.cs b/Application/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProvider.cs index 2f57bf7939..1d72aa6c69 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProvider.cs +++ b/Application/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProvider.cs @@ -13,6 +13,8 @@ using EdFi.Ods.Common.Models.Domain; using EdFi.Ods.Common.Models.Resource; using EdFi.Ods.Api.Security.Conventions; +using EdFi.Ods.Common.Models; +using EdFi.Ods.Common.Security.Authorization; namespace EdFi.Ods.Api.Security.Authorization { @@ -24,14 +26,38 @@ public class ResourceClaimUriProvider : IResourceClaimUriProvider private readonly ISchemaNameMapProvider _schemaNameMapProvider; private readonly ConcurrentDictionary _resourceUrisByResourceType = new(); private readonly ConcurrentDictionary _resourceUrisByResourceFullName = new(); + private readonly Lazy> _resourceFullNameByResourceUri; /// /// Initializes a new instance of the class using the supplied schema name map provider. /// /// The provider for mapping between schema names. - public ResourceClaimUriProvider(ISchemaNameMapProvider schemaNameMapProvider) + /// + public ResourceClaimUriProvider(ISchemaNameMapProvider schemaNameMapProvider, IResourceModelProvider resourceModelProvider) { - _schemaNameMapProvider = Preconditions.ThrowIfNull(schemaNameMapProvider, nameof(schemaNameMapProvider)); + ArgumentNullException.ThrowIfNull(schemaNameMapProvider, nameof(schemaNameMapProvider)); + _schemaNameMapProvider = schemaNameMapProvider; + + _resourceFullNameByResourceUri = new Lazy>( + () => + { + var resourceFullNameByResourceUri = new ConcurrentDictionary(); + + foreach (var resource in resourceModelProvider.GetResourceModel().GetAllResources()) + { + resourceFullNameByResourceUri.TryAdd( + CreateSchemaBasedResourceClaimUri(resource.SchemaUriSegment(), resource.Name), + resource.FullName); + + // Add legacy representation for Ed-Fi Standard resources + if (resource.FullName.Schema == EdFiConventions.PhysicalSchemaName) + { + resourceFullNameByResourceUri.TryAdd(CreateLegacyResourceClaimUri(resource.Name), resource.FullName); + } + } + + return resourceFullNameByResourceUri; + }); } /// @@ -41,7 +67,7 @@ public ResourceClaimUriProvider(ISchemaNameMapProvider schemaNameMapProvider) /// The resource claim URIs. public string[] GetResourceClaimUris(Type resourceType) { - Preconditions.ThrowIfNull(resourceType, nameof(resourceType)); + ArgumentNullException.ThrowIfNull(resourceType, nameof(resourceType)); return _resourceUrisByResourceType.GetOrAdd( resourceType, @@ -54,15 +80,22 @@ public string[] GetResourceClaimUris(Type resourceType) var schemaNameMap = schemaNameMapProvider.GetSchemaMapByProperCaseName(schemaProperCaseName); - var uris = new[] - { - // Schema-based URI format - CreateSchemaBasedResourceClaimUri(schemaNameMap.UriSegment, resourceName), + // Include legacy representation for Ed-Fi Standard resources only + var uris = (schemaNameMap.PhysicalName == EdFiConventions.PhysicalSchemaName) + ? new[] + { + // Schema-based URI format + CreateSchemaBasedResourceClaimUri(schemaNameMap.UriSegment, resourceName), + + // Legacy URI format + CreateLegacyResourceClaimUri(resourceName), + } + : new[] + { + // Schema-based URI format + CreateSchemaBasedResourceClaimUri(schemaNameMap.UriSegment, resourceName), + }; - // Legacy URI format - CreateLegacyResourceClaimUri(resourceName), - }; - // Opportunistic assignment to map keyed by resource full name resourceUrisByResourceFullName.TryAdd(new FullName(schemaNameMap.PhysicalName, resourceName), uris); @@ -78,24 +111,46 @@ public string[] GetResourceClaimUris(Type resourceType) /// The resource claim URIs. public string[] GetResourceClaimUris(Resource resource) { - Preconditions.ThrowIfNull(resource, nameof(resource)); + ArgumentNullException.ThrowIfNull(resource, nameof(resource)); return _resourceUrisByResourceFullName.GetOrAdd( resource.FullName, (fn, res) => { - return new[] - { - // Schema-based URI format - CreateSchemaBasedResourceClaimUri(res.SchemaUriSegment(), res.Name), + // Include legacy representation for Ed-Fi Standard resources only + return (res.FullName.Schema == EdFiConventions.PhysicalSchemaName) + ? new[] + { + // Schema-based URI format + CreateSchemaBasedResourceClaimUri(res.SchemaUriSegment(), res.Name), - // Legacy URI format - CreateLegacyResourceClaimUri(res.Name), - }; + // Legacy URI format + CreateLegacyResourceClaimUri(res.Name), + } + : new[] + { + // Schema-based URI format + CreateSchemaBasedResourceClaimUri(res.SchemaUriSegment(), res.Name), + }; }, resource); } + public FullName GetResourceFullName(string[] resourceClaimUris) + { + ArgumentNullException.ThrowIfNull(resourceClaimUris, nameof(resourceClaimUris)); + + foreach (string resourceClaimUri in resourceClaimUris) + { + if (_resourceFullNameByResourceUri.Value.TryGetValue(resourceClaimUri, out var resourceName)) + { + return resourceName; + } + } + + throw new Exception($"Unable to identify resource from supplied '{nameof(resourceClaimUris)}' argument."); + } + /// /// Gets the resource URI for the supplied resource name, based on convention of the resource's schema URI segment followed by the camel-cased resource name as a suffix on the Ed-Fi resource URI base value. /// diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/AuthorizationStrategyNameAttribute.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/AuthorizationStrategyNameAttribute.cs new file mode 100644 index 0000000000..86f17b4604 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/AuthorizationStrategyNameAttribute.cs @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: Apache-2.0 +// Licensed to the Ed-Fi Alliance under one or more agreements. +// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +// See the LICENSE and NOTICES files in the project root for more information. + +using System; +using EdFi.Ods.Common.Security.Authorization; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies; + +/// +/// Provides the authorization strategy name that is associated with an implementation +/// (replacing the previously used class naming convention). +/// +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +public sealed class AuthorizationStrategyNameAttribute : Attribute +{ + public AuthorizationStrategyNameAttribute(string name) + { + Name = name; + } + + public string Name { get; } +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationFilterDefinitionsFactory.cs new file mode 100644 index 0000000000..86ca5b5714 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationFilterDefinitionsFactory.cs @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: Apache-2.0 +// Licensed to the Ed-Fi Alliance under one or more agreements. +// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +// See the LICENSE and NOTICES files in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters; +using EdFi.Ods.Common.Database.NamingConventions; +using EdFi.Ods.Common.Database.Querying; +using EdFi.Ods.Common.Infrastructure.Filtering; +using EdFi.Ods.Common.Models.Resource; +using EdFi.Ods.Common.Security.Authorization; +using EdFi.Ods.Common.Security.Claims; +using NHibernate; +using NHibernate.Criterion; +using NHibernate.SqlCommand; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; + +// ------------------------------------------------------------------------------------------ +// TODO: ODS-6426, ODS-6427 - This file is a work-in-progress across multiple stories. +// ------------------------------------------------------------------------------------------ + +public class CustomViewBasedAuthorizationFilterDefinitionsFactory : IAuthorizationFilterDefinitionsFactory +{ + // private readonly IDatabaseNamingConvention _databaseNamingConvention; + // private readonly AuthorizationContextDataFactory _authorizationContextDataFactory = new(); + + private readonly IViewBasedSingleItemAuthorizationQuerySupport _viewBasedSingleItemAuthorizationQuerySupport; + private readonly ICustomViewBasisEntityProvider _customViewBasisEntityProvider; + + public CustomViewBasedAuthorizationFilterDefinitionsFactory( + // IDatabaseNamingConvention databaseNamingConvention, + IViewBasedSingleItemAuthorizationQuerySupport viewBasedSingleItemAuthorizationQuerySupport, + ICustomViewBasisEntityProvider customViewBasisEntityProvider) + { + // _databaseNamingConvention = databaseNamingConvention; + _viewBasedSingleItemAuthorizationQuerySupport = viewBasedSingleItemAuthorizationQuerySupport; + _customViewBasisEntityProvider = customViewBasisEntityProvider; + + // _oldNamespaceQueryColumnExpression = $"{TrackedChangesAlias}.{databaseNamingConvention.ColumnName($"OldNamespace")}"; + } + + public AuthorizationFilterDefinition CreateAuthorizationFilterDefinition(string filterName) + { + var result = _customViewBasisEntityProvider.GetBasisEntity(filterName); + + if (result.entity == null) + { + return null; + } + + var filter = + new ViewBasedAuthorizationFilterDefinition( + filterName, + filterName, + result.entity.Identifier.Properties.Select(p => p.PropertyName).ToArray(), + ApplyTrackedChangesAuthorizationCriteria, + // @"({currentAlias}.{subjectEndpointName} IS NOT NULL AND {currentAlias}.{subjectEndpointName} LIKE :Namespace)", + // ApplyAuthorizationCriteria, + // ApplyTrackedChangesAuthorizationCriteria, + AuthorizeInstance, + _viewBasedSingleItemAuthorizationQuerySupport); + + return filter; + } + + /// + /// Gets the authorization strategy's NHibernate filter definitions and a functional delegate for determining when to apply them. + /// + /// A read-only list of filter application details to be applied to the NHibernate configuration and mappings. + public IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() + { + return Array.Empty(); + } + + private static void ApplyAuthorizationCriteria( + ICriteria criteria, + Junction @where, + string[] subjectEndpointNames, + IDictionary parameters, + JoinType joinType) + { + throw new NotSupportedException(); + + // // Defensive check to ensure required parameter is present + // if (!parameters.TryGetValue(FilterPropertyName, out var parameterValue)) + // { + // throw new Exception( + // $"Unable to find parameter '{FilterPropertyName}' for applying namespace-based authorization. Available parameters: '{string.Join("', '", parameters.Keys)}'"); + // } + // + // // Ensure the Namespace parameter is represented as an object array + // var namespacePrefixes = parameterValue as object[] ?? new[] { parameterValue }; + // + // // Combine the namespace filters using OR (only one must match to grant authorization) + // var namespacesDisjunction = new Disjunction(); + // + // foreach (var namespacePrefix in namespacePrefixes) + // { + // namespacesDisjunction.Add(Restrictions.Like(subjectEndpointNames[0], namespacePrefix)); + // } + // + // // Add the final namespaces criteria to the supplied WHERE clause (junction) + // @where.Add(new AndExpression(Restrictions.IsNotNull(subjectEndpointNames[0]), namespacesDisjunction)); + } + + // private static PropertyMapping[] GetContextDataPropertyMappings(string resourceFullName, IEnumerable availablePropertyNames) + // { + // return new PropertyMapping[] + // { + // new( + // NamespaceAuthorizationConvention.GetNamespacePropertyName(resourceFullName, availablePropertyNames), + // "Namespace") + // }; + // } + + private InstanceAuthorizationResult AuthorizeInstance( + EdFiAuthorizationContext authorizationContext, + AuthorizationFilterContext authorizationFilterContext, + string authorizationStrategyName) + { + throw new NotSupportedException(); + // try + // { + // var contextData = + // _authorizationContextDataFactory.CreateContextData( + // authorizationContext.Data, getContextDataPropertyMappings: GetContextDataPropertyMappings); + // + // if (contextData == null) + // { + // return InstanceAuthorizationResult.Failed( + // new NotSupportedException( + // "No 'Namespace' (or Namespace-suffixed) property could be found on the resource in order to perform authorization. Should a different authorization strategy be used?")); + // } + // + // if (string.IsNullOrWhiteSpace(contextData.Namespace)) + // { + // string existingLiteral = authorizationContext.GetPhaseText("existing "); + // + // return InstanceAuthorizationResult.Failed( + // new SecurityAuthorizationException( + // SecurityAuthorizationException.DefaultDetail + $" The {existingLiteral}'Namespace' value has not been assigned but is required for authorization purposes.", + // authorizationContext.GetPhaseText($"The existing resource item is inaccessible to clients using the '{authorizationStrategyName}' authorization strategy because the 'Namespace' value has not been assigned.")) + // { + // InstanceTypeParts = authorizationContext.AuthorizationPhase == AuthorizationPhase.ProposedData + // // On proposed data + // ? ["namespace", "access-denied", "namespace-required"] + // // On existing data + // : ["namespace", "invalid-data", "namespace-uninitialized"] + // }); + // } + // + // var claimNamespacePrefixes = NamespaceBasedAuthorizationHelpers.GetClaimNamespacePrefixes(authorizationContext, authorizationStrategyName); + // + // if (!claimNamespacePrefixes.Any(ns => contextData.Namespace.StartsWithIgnoreCase(ns))) + // { + // string existingLiteral = authorizationContext.GetPhaseText("existing "); + // string claimNamespacePrefixesText = string.Join("', '", claimNamespacePrefixes); + // + // return InstanceAuthorizationResult.Failed( + // new SecurityAuthorizationException( + // SecurityAuthorizationException.DefaultDetail + $" The {existingLiteral}'Namespace' value of the data does not start with any of the caller's associated namespace prefixes ('{claimNamespacePrefixesText}').", null) + // { + // InstanceTypeParts = ["namespace", "access-denied", "namespace-mismatch"] + // }); + // } + // } + // catch (SecurityAuthorizationException ex) + // { + // return InstanceAuthorizationResult.Failed(ex); + // } + // + // return InstanceAuthorizationResult.Success(); + } + + private void ApplyTrackedChangesAuthorizationCriteria( + AuthorizationFilterDefinition filterDefinition, + AuthorizationFilterContext filterContext, + Resource resource, + int filterIndex, + QueryBuilder queryBuilder, + bool useOuterJoins) + { + throw new NotSupportedException(); + + // if (filterContext.ClaimParameterValues.Length == 1) + // { + // if (filterContext.SubjectEndpointName == "Namespace") + // { + // queryBuilder.WhereLike($"{_oldNamespaceQueryColumnExpression}", filterContext.ClaimParameterValues.Single()); + // } + // else + // { + // queryBuilder.WhereLike( + // $"{TrackedChangesAlias}.{_databaseNamingConvention.ColumnName($"Old{filterContext.SubjectEndpointName}")}", + // filterContext.ClaimParameterValues.Single()); + // } + // } + // else if (filterContext.ClaimParameterValues.Length > 1) + // { + // queryBuilder.Where( + // q => + // { + // if (filterContext.SubjectEndpointName == "Namespace") + // { + // filterContext.ClaimParameterValues.ForEach(ns => q.OrWhereLike(_oldNamespaceQueryColumnExpression, ns)); + // } + // else + // { + // filterContext.ClaimParameterValues.ForEach( + // ns => q.OrWhereLike( + // $"{TrackedChangesAlias}.{_databaseNamingConvention.ColumnName($"Old{filterContext.SubjectEndpointName}")}", + // ns)); + // } + // + // return q; + // }); + // } + // else + // { + // // This should never happen + // throw new SecurityAuthorizationException(SecurityAuthorizationException.DefaultTechnicalProblemDetail, "No namespaces found in claims."); + // } + } +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationStrategyProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationStrategyProvider.cs new file mode 100644 index 0000000000..fb1b1bd47d --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasedAuthorizationStrategyProvider.cs @@ -0,0 +1,40 @@ +using System; +using Autofac.Extras.DynamicProxy; +using EdFi.Ods.Common.Caching; +using EdFi.Ods.Common.Models.Domain; +using EdFi.Ods.Common.Security.Authorization; +using log4net; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; + +[Intercept(InterceptorCacheKeys.Security)] +public class CustomViewBasedAuthorizationStrategyProvider : IAuthorizationStrategyProvider +{ + private readonly ILog _logger = LogManager.GetLogger(typeof(CustomViewBasedAuthorizationStrategyProvider)); + + private readonly ICustomViewBasisEntityProvider _customViewBasisEntityProvider; + private readonly Func _customViewBasedAuthorizationFactory; + + public CustomViewBasedAuthorizationStrategyProvider( + ICustomViewBasisEntityProvider customViewBasisEntityProvider, + Func customViewBasedAuthorizationFactory) + { + _customViewBasisEntityProvider = customViewBasisEntityProvider; + _customViewBasedAuthorizationFactory = customViewBasedAuthorizationFactory; + } + + /// + public IAuthorizationStrategy GetByName(string authorizationStrategyName) + { + var result = _customViewBasisEntityProvider.GetBasisEntity(authorizationStrategyName); + + if (result.entity != null) + { + return _customViewBasedAuthorizationFactory(authorizationStrategyName, result.entity); + } + + _logger.Debug($"Authorization strategy name '{authorizationStrategyName}' failed to match any entities named '{result.attemptedEntityName}' in any schemas in the model..."); + + return null; + } +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasisEntityProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasisEntityProvider.cs new file mode 100644 index 0000000000..8e009846e4 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/CustomViewBasisEntityProvider.cs @@ -0,0 +1,58 @@ +using System.Collections.Concurrent; +using System.Linq; +using EdFi.Ods.Common.Conventions; +using EdFi.Ods.Common.Models; +using EdFi.Ods.Common.Models.Domain; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; + +public class CustomViewBasisEntityProvider : ICustomViewBasisEntityProvider +{ + private readonly IDomainModelProvider _domainModelProvider; + private readonly ConcurrentDictionary _basisEntityByStrategyName = new(); + + public CustomViewBasisEntityProvider(IDomainModelProvider domainModelProvider) + { + _domainModelProvider = domainModelProvider; + } + + /// + public (string attemptedEntityName, Entity entity) GetBasisEntity(string authorizationStrategyName) + { + int withPos = authorizationStrategyName.IndexOf("With"); + + // Custom view-based authorization strategy relies on strict convention-based naming: {BasisEntity}With... + if (withPos < 0) + { + return (null, null); + } + + return _basisEntityByStrategyName.GetOrAdd(authorizationStrategyName, + (n) => + { + string entityName = authorizationStrategyName.Substring(0, withPos); + + // Search first for the entity name in the Ed-Fi Standard + var entityFullName = new FullName(EdFiConventions.PhysicalSchemaName, entityName); + + if (_domainModelProvider.GetDomainModel().EntityByFullName.TryGetValue(entityFullName, out Entity edfiEntity)) + { + return (entityName, edfiEntity); + } + + // Search extension schemas + foreach (Schema schema in _domainModelProvider.GetDomainModel() + .Schemas.Where(s => s.PhysicalName != EdFiConventions.PhysicalSchemaName)) + { + entityFullName = new FullName(schema.PhysicalName, entityName); + + if (_domainModelProvider.GetDomainModel().EntityByFullName.TryGetValue(entityFullName, out Entity extensionEntity)) + { + return (entityName, extensionEntity); + } + } + + return (entityName, null); + }); + } +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/ICustomViewBasisEntityProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/ICustomViewBasisEntityProvider.cs new file mode 100644 index 0000000000..b483f1e5a8 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/CustomViewBased/ICustomViewBasisEntityProvider.cs @@ -0,0 +1,16 @@ +using EdFi.Ods.Common.Models.Domain; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; + +/// +/// Defines a method for getting the entity whose identity the authorization strategy is based upon. +/// +public interface ICustomViewBasisEntityProvider +{ + /// + /// Gets the entity whose identity the authorization strategy is based upon. + /// + /// The name of the authorization strategy to process using conventions to identify the entity that is the basis for authorization. + /// A tuple containing the entity, if identified, and the attempted entity name derived from the supplied authorization strategy name (if available) for logging/troubleshooting purposes. + (string attemptedEntityName, Entity entity) GetBasisEntity(string authorizationStrategyName); +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/IAuthorizationStrategyProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/IAuthorizationStrategyProvider.cs new file mode 100644 index 0000000000..a2cb420f27 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/IAuthorizationStrategyProvider.cs @@ -0,0 +1,13 @@ +using EdFi.Ods.Common.Security.Authorization; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies; + +public interface IAuthorizationStrategyProvider +{ + /// + /// Gets the IAuthorizationStrategy implementation for the authorization strategy, by name. + /// + /// + /// The IAuthorizationStrategy implementation for the authorization strategy if found; otherwise null. + IAuthorizationStrategy GetByName(string authorizationStrategyName); +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamedAuthorizationStrategyProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamedAuthorizationStrategyProvider.cs new file mode 100644 index 0000000000..0408b615e9 --- /dev/null +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamedAuthorizationStrategyProvider.cs @@ -0,0 +1,25 @@ +using Autofac.Features.Indexed; +using EdFi.Ods.Common.Security.Authorization; + +namespace EdFi.Ods.Api.Security.AuthorizationStrategies; + +/// +/// Implements an authorization strategy provider that resolves the providers from the container based on keyed registrations +/// where the key is the authorization strategy name. +/// +public class NamedAuthorizationStrategyProvider : IAuthorizationStrategyProvider +{ + private readonly IIndex _authorizationStrategyByName; + + public NamedAuthorizationStrategyProvider(IIndex authorizationStrategyByName) + { + _authorizationStrategyByName = authorizationStrategyByName; + } + + public IAuthorizationStrategy GetByName(string authorizationStrategyName) + { + return _authorizationStrategyByName.TryGetValue(authorizationStrategyName, out var authorizationStrategy) + ? authorizationStrategy + : null; + } +} diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationFilterDefinitionsFactory.cs index b4d07c6f36..4a2e77a41b 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationFilterDefinitionsFactory.cs @@ -39,11 +39,18 @@ public NamespaceBasedAuthorizationFilterDefinitionsFactory(IDatabaseNamingConven _oldNamespaceQueryColumnExpression = $"{TrackedChangesAlias}.{databaseNamingConvention.ColumnName($"OldNamespace")}"; } + /// + public AuthorizationFilterDefinition CreateAuthorizationFilterDefinition(string filterName) + { + // Only pre-defined filter definitions are created by this factory + return null; + } + /// /// Gets the authorization strategy's NHibernate filter definitions and a functional delegate for determining when to apply them. /// /// A read-only list of filter application details to be applied to the NHibernate configuration and mappings. - public IReadOnlyList CreateAuthorizationFilterDefinitions() + public IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { var filters = new List { @@ -61,10 +68,18 @@ public IReadOnlyList CreateAuthorizationFilterDef private static void ApplyAuthorizationCriteria( ICriteria criteria, Junction @where, - string subjectEndpointName, + string[] subjectEndpointNames, IDictionary parameters, - JoinType joinType) + JoinType joinType, + IAuthorizationStrategy authorizationStrategy) { + if (subjectEndpointNames.Length != 1) + { + throw new ArgumentException("Exactly one subject endpoint name was expected for namespace-based authorization."); + } + + string subjectEndpointName = subjectEndpointNames[0]; + // Defensive check to ensure required parameter is present if (!parameters.TryGetValue(FilterPropertyName, out var parameterValue)) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationStrategy.cs index 5c52e6a93d..186628c2d2 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NamespaceBased/NamespaceBasedAuthorizationStrategy.cs @@ -11,6 +11,7 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.NamespaceBased { + [AuthorizationStrategyName(AuthorizationStrategyName)] public class NamespaceBasedAuthorizationStrategy : IAuthorizationStrategy { private const string AuthorizationStrategyName = "NamespaceBased"; diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NoFurtherAuthorization/NoFurtherAuthorizationRequiredAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NoFurtherAuthorization/NoFurtherAuthorizationRequiredAuthorizationStrategy.cs index bd4633c61f..9eec26378a 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NoFurtherAuthorization/NoFurtherAuthorizationRequiredAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/NoFurtherAuthorization/NoFurtherAuthorizationRequiredAuthorizationStrategy.cs @@ -16,6 +16,7 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.NoFurtherAuthorization /// /// Implements an authorization strategy that performs no additional authorization. /// + [AuthorizationStrategyName(AuthorizationStrategyName)] public class NoFurtherAuthorizationRequiredAuthorizationStrategy : IAuthorizationStrategy { private const string AuthorizationStrategyName = "NoFurtherAuthorizationRequired"; diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationFilterDefinitionsFactory.cs index 3afa033898..ed5f92a9ea 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationFilterDefinitionsFactory.cs @@ -25,11 +25,17 @@ public class OwnershipBasedAuthorizationFilterDefinitionsFactory : IAuthorizatio private const string FilterPropertyName = "CreatedByOwnershipTokenId"; + public AuthorizationFilterDefinition CreateAuthorizationFilterDefinition(string filterName) + { + // Only pre-defined filter definitions are created by this factory + return null; + } + /// /// Gets the authorization strategy's NHibernate filter definitions and a functional delegate for determining when to apply them. /// /// A read-only list of filter application details to be applied to the NHibernate configuration and mappings. - public IReadOnlyList CreateAuthorizationFilterDefinitions() + public IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { var filters = new[] { @@ -47,9 +53,10 @@ public IReadOnlyList CreateAuthorizationFilterDef private static void ApplyAuthorizationCriteria( ICriteria criteria, Junction @where, - string subjectEndpointName, + string[] subjectEndpointNames, IDictionary parameters, - JoinType joinType) + JoinType joinType, + IAuthorizationStrategy authorizationStrategy) { // Defensive check to ensure required parameter is present if (!parameters.ContainsKey(FilterPropertyName)) diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationStrategy.cs index 28d77725b3..ba71c2a3fd 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/OwnershipBased/OwnershipBasedAuthorizationStrategy.cs @@ -9,6 +9,7 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.OwnershipBased { + [AuthorizationStrategyName(AuthorizationStrategyName)] public class OwnershipBasedAuthorizationStrategy : IAuthorizationStrategy { private const string AuthorizationStrategyName = "OwnershipBased"; diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ICriteriaExtensions.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ICriteriaExtensions.cs index 3f2eece798..64e017d398 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ICriteriaExtensions.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ICriteriaExtensions.cs @@ -5,9 +5,13 @@ using System; using System.Collections.Generic; +using EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; using EdFi.Ods.Common; using EdFi.Ods.Common.Conventions; using EdFi.Ods.Common.Infrastructure.Activities; +using EdFi.Ods.Common.Models.Domain; +using EdFi.Ods.Common.Security.Authorization; +using EdFi.Ods.Common.Security.CustomViewBased; using NHibernate; using NHibernate.Criterion; using NHibernate.SqlCommand; @@ -28,7 +32,7 @@ public static class ICriteriaExtensions /// The name of the property to be joined for the other property as authorization view. /// The to be used. /// The name of the property to be used for auth View Alias name. - public static void ApplyJoinFilter( + public static void ApplySingleColumnJoinFilter( this ICriteria criteria, IMultiValueRestrictions multiValueRestrictions, Junction whereJunction, @@ -92,5 +96,76 @@ private static string GetFullNameForView(this string viewName) { return Namespaces.Entities.NHibernate.QueryModels.GetViewNamespace(viewName); } + + /// + /// Applies a join-based filter to the criteria for the specified custom authorization view. + /// + /// The criteria to which filters should be applied. + /// The name of the view to be filtered. + /// The name of the property to be joined for the entity being queried. + /// The name of the property to be joined for the other property as authorization view. + /// The to be used. + /// The name of the property to be used for auth View Alias name. + /// The authorization strategy instance (which may be an instance providing additional context for authorization). + public static void ApplyCustomViewJoinFilter( + this ICriteria criteria, + string viewName, + string[] subjectEndpointNames, + string[] viewTargetEndpointNames, + JoinType joinType, + string authViewAlias, + IAuthorizationStrategy authorizationStrategy) + { + if (authorizationStrategy is not CustomViewBasedAuthorizationStrategy customViewBasedAuthorizationStrategy) + { + throw new Exception( + $"The authorization strategy supplied to the '{nameof(ApplyCustomViewJoinFilter)}' was not of the expected type '{nameof(CustomViewBasedAuthorizationStrategy)}'."); + } + + string authViewFullAlias = $"{CustomViewHelpers.GetAliasPrefix(viewName)}{authViewAlias}"; + + if (subjectEndpointNames.Length == 1) + { + // Apply authorization join using ICriteria + criteria.CreateEntityAlias( + authViewFullAlias, + Restrictions.EqProperty( + $"aggregateRoot.{subjectEndpointNames[0]}", + $"{authViewFullAlias}.{viewTargetEndpointNames[0]}"), + joinType, + customViewBasedAuthorizationStrategy.BasisEntity.EntityTypeFullName()); + } + else + { + // Apply authorization join using ICriteria + criteria.CreateEntityAlias( + authViewFullAlias, + BuildJoinCriterion(0), + joinType, + customViewBasedAuthorizationStrategy.BasisEntity.EntityTypeFullName()); + + ICriterion BuildJoinCriterion(int endPointIndex) + { + // If this is the last 2 names, build an And expression and terminate recursion + if (endPointIndex == subjectEndpointNames.Length - 2) + { + return new AndExpression( + Restrictions.EqProperty( + $"aggregateRoot.{subjectEndpointNames[endPointIndex]}", + $"{authViewFullAlias}.{viewTargetEndpointNames[endPointIndex]}"), + Restrictions.EqProperty( + $"aggregateRoot.{subjectEndpointNames[endPointIndex + 1]}", + $"{authViewFullAlias}.{viewTargetEndpointNames[endPointIndex + 1]}")); + } + + // Recursively build the and expression + return new AndExpression( + Restrictions.EqProperty( + $"aggregateRoot.{subjectEndpointNames[endPointIndex]}", + $"{authViewFullAlias}.{viewTargetEndpointNames[endPointIndex]}"), + BuildJoinCriterion(endPointIndex + 1)); + } + } + } } } diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ViewBasedAuthorizationFilterDefinition.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ViewBasedAuthorizationFilterDefinition.cs index 6d2d292c31..1436c28b8e 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ViewBasedAuthorizationFilterDefinition.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/Filters/ViewBasedAuthorizationFilterDefinition.cs @@ -12,10 +12,26 @@ using EdFi.Ods.Common.Security.Authorization; using EdFi.Ods.Common.Security.Claims; +// ------------------------------------------------------------------------------------------ +// TODO: ODS-6426, ODS-6427 - This file is a work-in-progress across multiple stories. +// ------------------------------------------------------------------------------------------ + namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters { public class ViewBasedAuthorizationFilterDefinition : AuthorizationFilterDefinition { + /// + /// Initializes a new instance of the class using parameters for a + /// relationship-based authorization view join using a single column. + /// + /// + /// + /// + /// + /// + /// + /// + /// public ViewBasedAuthorizationFilterDefinition( string filterName, string viewName, @@ -31,16 +47,24 @@ public ViewBasedAuthorizationFilterDefinition( SELECT {{newAlias1}}.{viewTargetEndpointName} FROM {GetFullNameForView($"auth_{viewName}")} {{newAlias1}} WHERE {{newAlias1}}.{viewSourceEndpointName} IN (:{RelationshipAuthorizationConventions.ClaimsParameterName}))", - (criteria, @where, subjectEndpointName, parameters, joinType) => criteria.ApplyJoinFilter( - multiValueRestrictions, - @where, - parameters, - viewName, - subjectEndpointName, - viewSourceEndpointName, - viewTargetEndpointName, - joinType, - Guid.NewGuid().ToString("N")), + (criteria, @where, subjectEndpointNames, parameters, joinType, authorizationStrategy) => + { + if (subjectEndpointNames?.Length != 1) + { + throw new ArgumentException("Exactly one authorization subject endpoint name is expected for single-column view-based authorization."); + } + + criteria.ApplySingleColumnJoinFilter( + multiValueRestrictions, + @where, + parameters, + viewName, + subjectEndpointNames[0], + viewSourceEndpointName, + viewTargetEndpointName, + joinType, + Guid.NewGuid().ToString("N")); + }, trackedChangesCriteriaApplicator, authorizeInstance) { @@ -50,10 +74,57 @@ public ViewBasedAuthorizationFilterDefinition( ViewBasedSingleItemAuthorizationQuerySupport = viewBasedSingleItemAuthorizationQuerySupport; } + /// + /// Initializes a new instance of the class using parameters for a + /// custom view-based authorization join. + /// + /// + /// + /// + /// + /// + /// + public ViewBasedAuthorizationFilterDefinition( + string filterName, + string viewName, + // string viewSourceEndpointName, + string[] viewTargetEndpointNames, + Action trackedChangesCriteriaApplicator, + Func authorizeInstance, + IViewBasedSingleItemAuthorizationQuerySupport viewBasedSingleItemAuthorizationQuerySupport) //, + // IMultiValueRestrictions multiValueRestrictions) + : base( + filterName, + $@"{{currentAlias}}.{{subjectEndpointName}} IN ( + SELECT {{newAlias1}}.{viewTargetEndpointNames[0]} // TODO: Fix HQL + FROM {GetFullNameForView($"auth_{viewName}")} {{newAlias1}} )", + //WHERE {{newAlias1}}.{viewSourceEndpointName} IN (:{RelationshipAuthorizationConventions.ClaimsParameterName}))", + (criteria, @where, subjectEndpointNames, parameters, joinType, authorizationStrategy) + => criteria.ApplyCustomViewJoinFilter( + // multiValueRestrictions, + // @where, + // parameters, + viewName, + subjectEndpointNames, + // viewSourceEndpointName, + viewTargetEndpointNames, + joinType, + Guid.NewGuid().ToString("N"), + authorizationStrategy), + trackedChangesCriteriaApplicator, + authorizeInstance) + { + ViewName = viewName; + // ViewSourceEndpointName = viewSourceEndpointName; + ViewTargetEndpointNames = viewTargetEndpointNames; + ViewBasedSingleItemAuthorizationQuerySupport = viewBasedSingleItemAuthorizationQuerySupport; + } + public string ViewName { get; } public string ViewSourceEndpointName { get; } public string ViewTargetEndpointName { get; } + public string[] ViewTargetEndpointNames { get; } public IViewBasedSingleItemAuthorizationQuerySupport ViewBasedSingleItemAuthorizationQuerySupport { get; set; } diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProvider.cs index d0f3df5fa5..11810b1d27 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProvider.cs @@ -11,37 +11,34 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships /// Defines a generic method for obtaining Ed-Fi authorization context data for a specific entity type. /// /// The abstract model type (e.g. IStudent) for which to retrieve authorization context data. - /// - public interface IRelationshipsAuthorizationContextDataProvider - : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public interface IRelationshipsAuthorizationContextDataProvider + : IRelationshipsAuthorizationContextDataProvider { /// /// Gets the Ed-Fi authorization context data to be used in an authorization decision. /// /// The resource model from which authorization context data is to be derived. /// The authorization context data. - TContextData GetContextData(TAbstractModel resource); + RelationshipsAuthorizationContextData GetContextData(TAbstractModel resource); } /// /// Defines a non-generic method for obtaining Ed-Fi authorization context data for a specific entity type. /// /// This interface is intended to be used as a non-generic invocation mechanism from within the - /// for invoking the non-generic implementation + /// for invoking the non-generic implementation /// after obtaining it from the . The crux of the issue is that the context /// data providers are implemented and registered based on the model abstraction (e.g. IStudent) rather than /// either of the concrete models (e.g. Student (resource) or Student (entity)). /// - public interface IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public interface IRelationshipsAuthorizationContextDataProvider { /// /// Gets the Ed-Fi authorization context data to be used in an authorization decision. /// /// The resource model from which authorization context data is to be derived. /// The authorization context data. - TContextData GetContextData(object resource); + RelationshipsAuthorizationContextData GetContextData(object resource); /// /// Gets the properties that are relevant for relationship-based authorization. diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProviderFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProviderFactory.cs index cc62249676..0a0cab9b08 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProviderFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/IRelationshipsAuthorizationContextDataProviderFactory.cs @@ -17,8 +17,7 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships /// after obtaining it from the . The crux of the issue is that the context /// data providers are implemented and registered based on the model abstraction (e.g. IStudent) rather than /// either of the concrete models (e.g. Student (resource) or Student (entity)). - public interface IRelationshipsAuthorizationContextDataProviderFactory - where TContextData : RelationshipsAuthorizationContextData, new() + public interface IRelationshipsAuthorizationContextDataProviderFactory { /// /// Get the implementation appropriate for the @@ -26,6 +25,6 @@ public interface IRelationshipsAuthorizationContextDataProviderFactory /// The non-generic context data provider for the requested entity type. - IRelationshipsAuthorizationContextDataProvider GetProvider(Type entityType); + IRelationshipsAuthorizationContextDataProvider GetProvider(Type entityType); } } diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationContextDataProviderFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationContextDataProviderFactory.cs index 38b5a935a7..3988952044 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationContextDataProviderFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationContextDataProviderFactory.cs @@ -10,20 +10,19 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { /// - /// Defines a method for obtaining an + /// Defines a method for obtaining an /// for the specified concrete model type. /// /// This interface is intended to be used as a non-generic invocation mechanism from within the - /// for invoking the non-generic implementation + /// for invoking the non-generic implementation /// after obtaining it from the . The crux of the issue is that the context /// data providers are implemented and registered based on the model abstraction (e.g. IStudent) rather than /// either of the concrete models (e.g. Student (resource) or Student (entity)). - public class RelationshipsAuthorizationContextDataProviderFactory - : IRelationshipsAuthorizationContextDataProviderFactory - where TContextData : RelationshipsAuthorizationContextData, new() + public class RelationshipsAuthorizationContextDataProviderFactory + : IRelationshipsAuthorizationContextDataProviderFactory { // ReSharper disable once StaticMemberInGenericType - private static readonly ConcurrentDictionary ProvidersByModelType = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary ProvidersByModelType = new(); private readonly IServiceLocator _serviceLocator; public RelationshipsAuthorizationContextDataProviderFactory(IServiceLocator serviceLocator) @@ -32,19 +31,18 @@ public RelationshipsAuthorizationContextDataProviderFactory(IServiceLocator serv } /// - /// Get the implementation appropriate for the + /// Get the implementation appropriate for the /// concrete model type specified (resolving to the IoC registration for the model's interface /// abstraction [e.g. IStudent]). /// - ///// The concrete model class type. /// The non-generic context data provider for the requested concrete model type. - public IRelationshipsAuthorizationContextDataProvider GetProvider(Type entityType) + public IRelationshipsAuthorizationContextDataProvider GetProvider(Type entityType) { Type lookupType = GetProviderLookupType(entityType); try { - var provider = (IRelationshipsAuthorizationContextDataProvider) + var provider = (IRelationshipsAuthorizationContextDataProvider) _serviceLocator.Resolve(lookupType); return provider; @@ -72,8 +70,8 @@ protected Type GetProviderLookupType(Type model) : mt.GetInterface("I" + mt.Name); // Create the type to be used to find the model's abstraction-based container registration - var lookupType = typeof(IRelationshipsAuthorizationContextDataProvider<,>) - .MakeGenericType(modelInterface, typeof(TContextData)); + var lookupType = typeof(IRelationshipsAuthorizationContextDataProvider<>) + .MakeGenericType(modelInterface); return lookupType; }); diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyBase.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyBase.cs index df5c1a0264..f3a43a58f2 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyBase.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyBase.cs @@ -9,8 +9,6 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; -using EdFi.Common.Extensions; -using EdFi.Ods.Api.Extensions; using EdFi.Ods.Common.Attributes; using EdFi.Ods.Common.Exceptions; using EdFi.Ods.Common.Models; @@ -20,36 +18,22 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public abstract class RelationshipsAuthorizationStrategyBase : IAuthorizationStrategy - where TContextData : RelationshipsAuthorizationContextData, new() + public abstract class RelationshipsAuthorizationStrategyBase : IAuthorizationStrategy { private List _dependencyValidationResults; - private readonly Lazy _authorizationStrategyName; - private readonly DomainModel _domainModel; protected RelationshipsAuthorizationStrategyBase(IDomainModelProvider domainModelProvider) { _domainModel = domainModelProvider.GetDomainModel(); - - _authorizationStrategyName = new Lazy( - () => - { - // Ensure name of class follows conventions - if (!this.GetType().Name.TrimAt("`1").TryTrimSuffix("AuthorizationStrategy", out string authorizationStrategyName)) - { - throw new Exception( - $"Naming of authorization strategy implementation class '{this.GetType().Name}' did not follow expected convention of using a suffix of 'AuthorizationStrategy'."); - } - - return authorizationStrategyName; - }); } + protected abstract string AuthorizationStrategyName { get; } + // Define all required dependencies, injected through property injection for brevity in custom implementations [Required] - public IRelationshipsAuthorizationContextDataProviderFactory RelationshipsAuthorizationContextDataProviderFactory { get; set; } + public IRelationshipsAuthorizationContextDataProviderFactory RelationshipsAuthorizationContextDataProviderFactory { get; set; } /// /// Applies filtering to a multiple-item request. @@ -91,7 +75,7 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( { throw new SecurityConfigurationException( SecurityConfigurationException.DefaultDetail, - $"Authorization strategy '{_authorizationStrategyName.Value}' processed the authorization context names '{string.Join("', '", authorizationContextTuples.Select(t => t.name))}' and produced no authorization subjects, meaning no authorization filtering will be performed. Are you using the correct authorization strategy for this resource?"); + $"Authorization strategy '{AuthorizationStrategyName}' processed the authorization context names '{string.Join("', '", authorizationContextTuples.Select(t => t.name))}' and produced no authorization subjects, meaning no authorization filtering will be performed. Are you using the correct authorization strategy for this resource?"); } var filters = authorizationSubjectEndpoints @@ -113,7 +97,7 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( return new AuthorizationStrategyFiltering { - AuthorizationStrategyName = _authorizationStrategyName.Value, + AuthorizationStrategyName = AuthorizationStrategyName, Filters = filters, Operator = FilterOperator.Or }; diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyFilterDefinitionsFactory.cs index 7fb4ea4e2a..9f627448a3 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsAuthorizationStrategyFilterDefinitionsFactory.cs @@ -47,7 +47,13 @@ public RelationshipsAuthorizationStrategyFilterDefinitionsFactory( _multiValueRestrictions = multiValueRestrictions; } - public virtual IReadOnlyList CreateAuthorizationFilterDefinitions() + public AuthorizationFilterDefinition CreateAuthorizationFilterDefinition(string filterName) + { + // Only pre-defined filter definitions are created by this factory + return null; + } + + public virtual IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { return CreateAllEducationOrganizationToPersonFilters() .Concat(CreateAllEducationOrganizationToEducationOrganizationFilters()) diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy.cs index ce20c7a9df..b0a3c430e5 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy.cs @@ -9,13 +9,20 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithEdOrgsAndPeople"; + public RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy(IDomainModelProvider domainModelProvider) : base(domainModelProvider) { } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy.cs index 65120bf842..6bc4f6eccc 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithEdOrgsAndPeopleIncludingDeletes"; + private readonly IPersonEntitySpecification _personEntitySpecification; public RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategy( _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs index 48f0182d22..a92fa40ffe 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs @@ -30,7 +30,7 @@ public RelationshipsWithEdOrgsAndPeopleIncludingDeletesAuthorizationStrategyFilt personTypesProvider, multiValueRestrictions) { } - public override IReadOnlyList CreateAuthorizationFilterDefinitions() + public override IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { return CreateAllEducationOrganizationToPersonFilters(authorizationPathModifier: "IncludingDeletes").ToArray(); } diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy.cs index 4cca29dd20..a6d049c87c 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; -public class RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() +[AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] +public class RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithEdOrgsAndPeopleInverted"; + private readonly IPersonEntitySpecification _personEntitySpecification; public RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithEdOrgsAndPeopleInvertedAuthorizationStrategy( _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyAuthorizationStrategy.cs index c2be6aff55..3f96fdf249 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithEdOrgsOnlyAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithEdOrgsOnlyAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithEdOrgsOnly"; + private readonly IEducationOrganizationIdNamesProvider _educationOrganizationIdNamesProvider; public RelationshipsWithEdOrgsOnlyAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithEdOrgsOnlyAuthorizationStrategy( _educationOrganizationIdNamesProvider = educationOrganizationIdNamesProvider; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy.cs index 61276d51ba..55208660c2 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; -public class RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() +[AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] +public class RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithEdOrgsOnlyInverted"; + private readonly IEducationOrganizationIdNamesProvider _educationOrganizationIdNamesProvider; public RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithEdOrgsOnlyInvertedAuthorizationStrategy( _educationOrganizationIdNamesProvider = educationOrganizationIdNamesProvider; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithPeopleOnlyAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithPeopleOnlyAuthorizationStrategy.cs index 76cc29f09c..6eefc42564 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithPeopleOnlyAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithPeopleOnlyAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithPeopleOnlyAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithPeopleOnlyAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithPeopleOnly"; + private readonly IPersonEntitySpecification _personEntitySpecification; public RelationshipsWithPeopleOnlyAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithPeopleOnlyAuthorizationStrategy( _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyAuthorizationStrategy.cs index c21a0da2b3..643d5e50f4 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithStudentsOnlyAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithStudentsOnlyAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithStudentsOnly"; + private readonly IPersonEntitySpecification _personEntitySpecification; public RelationshipsWithStudentsOnlyAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithStudentsOnlyAuthorizationStrategy( _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy.cs index 3ef2f3e9b2..bb5c53e8ce 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - public class RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() + [AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] + public class RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithStudentsOnlyThroughResponsibility"; + private readonly IPersonEntitySpecification _personEntitySpecification; public RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy( @@ -24,6 +26,11 @@ public RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategy( _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategyFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategyFilterDefinitionsFactory.cs index 1f699eb41b..f9a78bb0e2 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategyFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategyFilterDefinitionsFactory.cs @@ -30,7 +30,7 @@ public RelationshipsWithStudentsOnlyThroughResponsibilityAuthorizationStrategyFi personTypesProvider, multiValueRestrictions) { } - public override IReadOnlyList CreateAuthorizationFilterDefinitions() + public override IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { return CreateAllEducationOrganizationToPersonFilters( shouldIncludePersonType: pt => pt == WellKnownPersonTypes.Student, diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.cs index adfb430cbb..686f122f6d 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.cs @@ -10,10 +10,12 @@ namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; -public class RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy - : RelationshipsAuthorizationStrategyBase - where TContextData : RelationshipsAuthorizationContextData, new() +[AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] +public class RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy + : RelationshipsAuthorizationStrategyBase { + private const string RelationshipAuthorizationStrategyName = "RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletes"; + private readonly IPersonEntitySpecification _personEntitySpecification; // NOTE: @@ -32,6 +34,11 @@ public RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthori _personEntitySpecification = personEntitySpecification; } + protected override string AuthorizationStrategyName + { + get => RelationshipAuthorizationStrategyName; + } + protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( IEnumerable<(string name, object value)> authorizationContextTuples) { diff --git a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs index 355037c6da..f5d12eaef0 100644 --- a/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Api/Security/AuthorizationStrategies/Relationships/RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategyFilterDefinitionsFactory.cs @@ -30,9 +30,9 @@ public RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthori personTypesProvider, multiValueRestrictions) { } - public override IReadOnlyList CreateAuthorizationFilterDefinitions() + public override IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions() { - string authorizationPathModifier = RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.AuthorizationPathModifier; + string authorizationPathModifier = RelationshipsWithStudentsOnlyThroughResponsibilityIncludingDeletesAuthorizationStrategy.AuthorizationPathModifier; return CreateAllEducationOrganizationToPersonFilters( shouldIncludePersonType: pt => pt == WellKnownPersonTypes.Student, diff --git a/Application/EdFi.Ods.Api/Security/Container/Modules/SecurityModule.cs b/Application/EdFi.Ods.Api/Security/Container/Modules/SecurityModule.cs index 73931e5413..ca5eb344de 100644 --- a/Application/EdFi.Ods.Api/Security/Container/Modules/SecurityModule.cs +++ b/Application/EdFi.Ods.Api/Security/Container/Modules/SecurityModule.cs @@ -5,6 +5,7 @@ using System; using System.Linq; +using System.Reflection; using Autofac; using Autofac.Extras.DynamicProxy; using EdFi.Ods.Common.Infrastructure.Filtering; @@ -15,10 +16,12 @@ using EdFi.Ods.Api.Security.Authorization.Pipeline; using EdFi.Ods.Api.Security.Authorization.Repositories; using EdFi.Ods.Api.Security.AuthorizationStrategies; +using EdFi.Ods.Api.Security.AuthorizationStrategies.CustomViewBased; using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; using EdFi.Ods.Api.Security.Claims; using EdFi.Ods.Api.Security.Utilities; +using Module = Autofac.Module; namespace EdFi.Ods.Api.Security.Container.Modules { @@ -52,29 +55,28 @@ protected override void Load(ContainerBuilder builder) .As() .SingleInstance(); - var assembly = typeof(Marker_EdFi_Ods_Api).Assembly; - var strategyTypes = assembly.GetTypes() - .Where(t => typeof(IAuthorizationStrategy).IsAssignableFrom(t) && !t.IsAbstract).ToList(); + builder.RegisterType() + .As() + .SingleInstance(); - foreach (Type strategyType in strategyTypes) - { - // Handle relationship based authorization strategies explicitly - if (strategyType.IsGenericType) - { - // Property injection is used for RelationshipsAuthorizationStrategyBase<> - builder.RegisterType(strategyType.MakeGenericType(typeof(RelationshipsAuthorizationContextData))) - .PropertiesAutowired() - .As() - .SingleInstance(); - } - else - { - builder.RegisterType(strategyType) - .As() - .SingleInstance(); - } - } + // Register support for custom view-based authorization + builder.RegisterType() + // Allow caching of information until the security metadata is refreshed + .EnableClassInterceptors() + .As() + .SingleInstance(); + + builder.RegisterType() + .AsSelf(); + + builder.RegisterType() + .As() + .SingleInstance(); + + var assembly = typeof(Marker_EdFi_Ods_Api).Assembly; + + RegisterNamedAuthorizationStrategies(); builder.RegisterAssemblyTypes(typeof(Marker_EdFi_Ods_Api).Assembly) .Where(t => typeof(IAuthorizationFilterDefinitionsFactory).IsAssignableFrom(t)) @@ -108,15 +110,10 @@ protected override void Load(ContainerBuilder builder) .SingleInstance(); // RelationshipsAuthorizationContextDataProviderFactory - builder.RegisterType( - typeof(RelationshipsAuthorizationContextDataProviderFactory<>).MakeGenericType( - GetRelationshipBasedAuthorizationStrategyContextDataType())).As( - typeof(IRelationshipsAuthorizationContextDataProviderFactory<>).MakeGenericType( - GetRelationshipBasedAuthorizationStrategyContextDataType())) + builder.RegisterType() + .As() .SingleInstance(); - Type GetRelationshipBasedAuthorizationStrategyContextDataType() => typeof(RelationshipsAuthorizationContextData); - builder.RegisterGeneric(typeof(SetAuthorizationContextForGet<,,,>)) .AsSelf() .SingleInstance(); @@ -136,6 +133,28 @@ protected override void Load(ContainerBuilder builder) builder.RegisterType() .As() .SingleInstance(); + + void RegisterNamedAuthorizationStrategies() + { + var namedStrategyTypes = assembly.GetTypes() + .Where(t => typeof(IAuthorizationStrategy).IsAssignableFrom(t) && !t.IsAbstract) + .Select( + t => new + { + Type = t, + AuthorizationStrategyName = t.GetCustomAttribute()?.Name + }) + .Where(x => x.AuthorizationStrategyName != null) + .ToList(); + + foreach (var namedStrategyInfo in namedStrategyTypes) + { + builder.RegisterType(namedStrategyInfo.Type) + .PropertiesAutowired() // Convenience for DI for derived relationship-based authorization strategies + .Keyed(namedStrategyInfo.AuthorizationStrategyName) + .SingleInstance(); + } + } } } } diff --git a/Application/EdFi.Ods.Api/Startup/OdsStartupBase.cs b/Application/EdFi.Ods.Api/Startup/OdsStartupBase.cs index 87b7f76a1b..044df6e59a 100644 --- a/Application/EdFi.Ods.Api/Startup/OdsStartupBase.cs +++ b/Application/EdFi.Ods.Api/Startup/OdsStartupBase.cs @@ -420,7 +420,7 @@ void SetStaticResolvers() .HttpContext?.User; ResourceModelHelper.ResourceModel = - new Lazy( + new Lazy( () => Container.Resolve() .GetResourceModel()); diff --git a/Application/EdFi.Ods.Common/Caching/BytesExtensions.cs b/Application/EdFi.Ods.Common/Caching/BytesExtensions.cs index 92d6191e11..cec7bc24bc 100644 --- a/Application/EdFi.Ods.Common/Caching/BytesExtensions.cs +++ b/Application/EdFi.Ods.Common/Caching/BytesExtensions.cs @@ -98,6 +98,12 @@ private static byte[] GetBytes(this IList value) private static byte[] GetArrayBytes(List byteArrays) { + // Handle the simple, single array case first + if (byteArrays.Count == 1) + { + return xxHash3.ComputeHash(byteArrays[0], byteArrays[0].Length).GetBytes(); + } + var totalBytes = byteArrays.Sum(x => x.Length + 1); var buffer = ArrayPool.Shared.Rent(totalBytes); @@ -109,7 +115,7 @@ private static byte[] GetArrayBytes(List byteArrays) foreach (byte[] valueAsBytes in byteArrays) { valueAsBytes.AsSpan().CopyTo(buffer.AsSpan(startIndex)); - _enumerableItemDelimiter.AsSpan().CopyTo(buffer.AsSpan(valueAsBytes.Length + 1)); + _enumerableItemDelimiter.AsSpan().CopyTo(buffer.AsSpan(startIndex + valueAsBytes.Length)); startIndex += valueAsBytes.Length + 1; } diff --git a/Application/EdFi.Ods.Common/Infrastructure/Configuration/NHibernateConfigurationExtensions.cs b/Application/EdFi.Ods.Common/Infrastructure/Configuration/NHibernateConfigurationExtensions.cs index bd231359ff..9c29daad6d 100644 --- a/Application/EdFi.Ods.Common/Infrastructure/Configuration/NHibernateConfigurationExtensions.cs +++ b/Application/EdFi.Ods.Common/Infrastructure/Configuration/NHibernateConfigurationExtensions.cs @@ -20,7 +20,7 @@ public static void AddCreateDateHooks( Func entityAuthorizerResolver, IAuthorizationContextProvider authorizationContextProvider) { - configuration.Interceptor = new CreateDateBasedTransientInterceptor(); + configuration.Interceptor = new EdFiOdsInterceptor(); configuration.SetListener(ListenerType.PreInsert, new EdFiOdsPreInsertListener()); configuration.SetListener(ListenerType.PostInsert, new EdFiOdsPostInsertListener()); diff --git a/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinition.cs b/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinition.cs index c2b8c3483d..1466e69b8a 100644 --- a/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinition.cs +++ b/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinition.cs @@ -31,7 +31,6 @@ public class AuthorizationFilterDefinition /// A function to apply the filter to the query using NHibernate's API. /// A function for applying the filter to the for tracked changes queries. /// A function that authorizes the instance contained in the authorization context data, or indicates that authorization cannot be performed without a trip to the database. - /// A predicate function using a mapped entity's and properties used to determine whether the filter should be applied to a particular entity. /// This constructor makes some base level assumptions to simplify the declaration of the filters, but /// it could lead to incorrect results. For parameters with names equal to "Id" or with names ending with "Id", /// it assumes the use of SQL Server Table-Valued Parameters typed as GUID or 32-bit integers, respectively. @@ -43,7 +42,7 @@ public class AuthorizationFilterDefinition public AuthorizationFilterDefinition( string filterName, string friendlyHqlConditionFormat, - Action, JoinType> criteriaApplicator, + Action, JoinType, IAuthorizationStrategy> criteriaApplicator, Action trackedChangesCriteriaApplicator, Func authorizeInstance) { @@ -64,7 +63,7 @@ public AuthorizationFilterDefinition( /// /// Gets the function for applying the filter using NHibernate's API. /// - public Action, JoinType> CriteriaApplicator { get; protected set; } + public Action, JoinType, IAuthorizationStrategy> CriteriaApplicator { get; protected set; } /// /// Gets the function for applying the filter to the for tracked changes queries. diff --git a/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinitionProvider.cs b/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinitionProvider.cs index 5f343dd9f2..da49a0548b 100644 --- a/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinitionProvider.cs +++ b/Application/EdFi.Ods.Common/Infrastructure/Filtering/AuthorizationFilterDefinitionProvider.cs @@ -4,6 +4,7 @@ // See the LICENSE and NOTICES files in the project root for more information. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -12,38 +13,52 @@ namespace EdFi.Ods.Common.Infrastructure.Filtering /// public class AuthorizationFilterDefinitionProvider : IAuthorizationFilterDefinitionProvider { - private readonly Lazy> _filterDefinitionByName; + private readonly IAuthorizationFilterDefinitionsFactory[] _authorizationFilterDefinitionsFactories; + private readonly Lazy> _predefinedFilterDefinitionByName; + private readonly ConcurrentDictionary _runtimeFilterDefinitionByName = new(); /// /// Initializes a new instance of the class using the supplied filter configurators. /// - /// - public AuthorizationFilterDefinitionProvider(IAuthorizationFilterDefinitionsFactory[] authorizationFilterDefinitionsProviders) + /// + public AuthorizationFilterDefinitionProvider(IAuthorizationFilterDefinitionsFactory[] authorizationFilterDefinitionsFactories) { - _filterDefinitionByName = new Lazy>( - () => authorizationFilterDefinitionsProviders + _authorizationFilterDefinitionsFactories = authorizationFilterDefinitionsFactories; + + _predefinedFilterDefinitionByName = new Lazy>( + () => authorizationFilterDefinitionsFactories // Sort the definitions providers to ensure a determinate alias generation during filter definition .OrderBy(p => p.GetType().FullName) - .SelectMany(c => c.CreateAuthorizationFilterDefinitions()) + .SelectMany(c => c.CreatePredefinedAuthorizationFilterDefinitions()) .Distinct() .ToDictionary(f => f.FilterName, f => f)); } - /// - public AuthorizationFilterDefinition GetFilterDefinition(string filterName) + /// + public AuthorizationFilterDefinition GetAuthorizationFilterDefinition(string filterName) { - if (!_filterDefinitionByName.Value.TryGetValue(filterName, out var filterApplicationDetails)) + if (TryGetAuthorizationFilterDefinition(filterName, out var filterDefinition)) { - throw new Exception($"Unable to find filter application details for filter '{filterName}'."); + return filterDefinition; } - - return filterApplicationDetails; + + throw new Exception($"Unable to find filter application details for filter '{filterName}'."); } /// public bool TryGetAuthorizationFilterDefinition(string filterName, out AuthorizationFilterDefinition authorizationFilterDefinition) { - return _filterDefinitionByName.Value.TryGetValue(filterName, out authorizationFilterDefinition); + if (!_predefinedFilterDefinitionByName.Value.TryGetValue(filterName, out authorizationFilterDefinition)) + { + authorizationFilterDefinition = _runtimeFilterDefinitionByName.GetOrAdd( + filterName, + static (fn, factories) => factories + .Select(f => f.CreateAuthorizationFilterDefinition(fn)) + .FirstOrDefault(fad => fad != null), + _authorizationFilterDefinitionsFactories); + } + + return authorizationFilterDefinition != null; } } } diff --git a/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionProvider.cs b/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionProvider.cs index 4ea8b51bd5..dd759b24bb 100644 --- a/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionProvider.cs +++ b/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionProvider.cs @@ -15,7 +15,7 @@ public interface IAuthorizationFilterDefinitionProvider /// /// The name of the filter. /// The details for applying the filter in various contexts. - AuthorizationFilterDefinition GetFilterDefinition(string filterName); + AuthorizationFilterDefinition GetAuthorizationFilterDefinition(string filterName); /// /// Attempts to get the filter definition containing information for applying the specified filter in various contexts. diff --git a/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionsFactory.cs b/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionsFactory.cs index 5cf93658e1..358abab638 100644 --- a/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionsFactory.cs +++ b/Application/EdFi.Ods.Common/Infrastructure/Filtering/IAuthorizationFilterDefinitionsFactory.cs @@ -8,7 +8,7 @@ namespace EdFi.Ods.Common.Infrastructure.Filtering { /// - /// Defines a method for creating named filters for use in authorization. + /// Defines methods for creating filter definitions for use in authorization. /// public interface IAuthorizationFilterDefinitionsFactory { @@ -16,6 +16,13 @@ public interface IAuthorizationFilterDefinitionsFactory /// Gets the NHibernate filter definitions and a functional delegate for determining when to apply them. /// /// A read-only list of filter application details to be applied to the NHibernate configuration and entity mappings. - IReadOnlyList CreateAuthorizationFilterDefinitions(); + IReadOnlyList CreatePredefinedAuthorizationFilterDefinitions(); + + /// + /// If supported by the factory, creates a single for the specified filter name. + /// + /// + /// The supported by the factory; otherwise null. + AuthorizationFilterDefinition CreateAuthorizationFilterDefinition(string filterName); } } diff --git a/Application/EdFi.Ods.Common/Infrastructure/Interceptors/CreateDateBasedTransientInterceptor.cs b/Application/EdFi.Ods.Common/Infrastructure/Interceptors/CreateDateBasedTransientInterceptor.cs deleted file mode 100644 index b69258f423..0000000000 --- a/Application/EdFi.Ods.Common/Infrastructure/Interceptors/CreateDateBasedTransientInterceptor.cs +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Licensed to the Ed-Fi Alliance under one or more agreements. -// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. -// See the LICENSE and NOTICES files in the project root for more information. - -using System; -using NHibernate; - -namespace EdFi.Ods.Common.Infrastructure.Interceptors -{ - public class CreateDateBasedTransientInterceptor : EmptyInterceptor - { - public override bool? IsTransient(object entity) - { - var property = entity.GetType() - .GetProperty("CreateDate"); - - if (property != null) - { - bool isTransient = Convert.ToDateTime(property.GetValue(entity)) == default(DateTime); - - return isTransient; - } - - return base.IsTransient(entity); - } - } -} diff --git a/Application/EdFi.Ods.Common/Infrastructure/Interceptors/EdFiOdsInterceptor.cs b/Application/EdFi.Ods.Common/Infrastructure/Interceptors/EdFiOdsInterceptor.cs new file mode 100644 index 0000000000..2ae5db6666 --- /dev/null +++ b/Application/EdFi.Ods.Common/Infrastructure/Interceptors/EdFiOdsInterceptor.cs @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: Apache-2.0 +// Licensed to the Ed-Fi Alliance under one or more agreements. +// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +// See the LICENSE and NOTICES files in the project root for more information. + +using System; +using System.Text.RegularExpressions; +using EdFi.Ods.Common.Conventions; +using EdFi.Ods.Common.Security.CustomViewBased; +using NHibernate; +using NHibernate.SqlCommand; + +namespace EdFi.Ods.Common.Infrastructure.Interceptors +{ + public class EdFiOdsInterceptor : EmptyInterceptor + { + private const string SpaceLiteral = " "; + + private static readonly Regex regex = new( + @$"(?inner join\s+)\(?(?\w+\.\w+) (?(?{CustomViewHelpers.CustomViewAliasPrefixBase}[a-f\d]{{4}}_).*?\d_).*?(?on\s+)", + RegexOptions.Compiled); + + public override bool? IsTransient(object entity) + { + var property = entity.GetType() + .GetProperty("CreateDate"); + + if (property != null) + { + bool isTransient = Convert.ToDateTime(property.GetValue(entity)) == default(DateTime); + + return isTransient; + } + + return base.IsTransient(entity); + } + + public override SqlString OnPrepareStatement(SqlString sql) + { + // Determine if we need to perform custom authorization view SQL manipulation + if (sql.IndexOf(CustomViewHelpers.CustomViewAliasPrefixBase, 0, sql.Length, StringComparison.Ordinal) >= 0) + { + var matches = regex.Matches(sql.ToString()); + + for (int i = matches.Count - 1; i >= 0; i--) + { + var match = matches[i]; + + var preamble = sql.Substring(0, match.Groups["join"].Index + match.Groups["join"].Length); + var viewName = CustomViewHelpers.GetViewName(match.Groups["aliasPrefix"].Value); + + var final = new SqlString( + preamble, + SystemConventions.AuthSchema, + ".", + viewName, + SpaceLiteral, + match.Groups["alias"].Value, + SpaceLiteral, + sql.Substring(match.Groups["onClause"].Index)); + + sql = final; + } + } + + return sql; + } + } +} diff --git a/Application/EdFi.Ods.Common/Models/Domain/EntityExtensions.cs b/Application/EdFi.Ods.Common/Models/Domain/EntityExtensions.cs index efa89bdb00..c8f81817c5 100644 --- a/Application/EdFi.Ods.Common/Models/Domain/EntityExtensions.cs +++ b/Application/EdFi.Ods.Common/Models/Domain/EntityExtensions.cs @@ -82,11 +82,11 @@ public static string SchemaUriSegment(this Entity entity) /// Proper case name associated with entity /// And specialized suffix that should be added to the class name based on the caller's context. /// Namespace qualified full name of the NHibernate Entity - public static string EntityTypeFullName(this Entity entity, string properCaseName, string classNameSuffix = "") + public static string EntityTypeFullName(this Entity entity, string properCaseName = null, string classNameSuffix = "") { return String.Format( "{0}.{1}{2}", - AggregateNamespace(entity, properCaseName), + AggregateNamespace(entity, properCaseName ?? entity.SchemaProperCaseName()), entity.IsEntityExtension ? entity.Name : entity.ResolvedEdFiEntityName(), diff --git a/Application/EdFi.Ods.Common/Models/IResourceModelProvider.cs b/Application/EdFi.Ods.Common/Models/IResourceModelProvider.cs index 3b884b843f..1cd67f7954 100644 --- a/Application/EdFi.Ods.Common/Models/IResourceModelProvider.cs +++ b/Application/EdFi.Ods.Common/Models/IResourceModelProvider.cs @@ -12,6 +12,6 @@ namespace EdFi.Ods.Common.Models /// public interface IResourceModelProvider { - ResourceModel GetResourceModel(); + IResourceModel GetResourceModel(); } } diff --git a/Application/EdFi.Ods.Common/Models/ProfileResourceModelProvider.cs b/Application/EdFi.Ods.Common/Models/ProfileResourceModelProvider.cs index b861fb95c5..c5453be549 100644 --- a/Application/EdFi.Ods.Common/Models/ProfileResourceModelProvider.cs +++ b/Application/EdFi.Ods.Common/Models/ProfileResourceModelProvider.cs @@ -22,7 +22,7 @@ public class ProfileResourceModelProvider : IProfileResourceModelProvider private readonly IProfileMetadataProvider _profileMetadataProvider; private readonly IProfileValidationReporter _profileValidationReporter; - private readonly Lazy _resourceModel; + private readonly Lazy _resourceModel; private readonly ILog _logger = LogManager.GetLogger(typeof(ProfileResourceModelProvider)); @@ -34,7 +34,7 @@ public ProfileResourceModelProvider( _profileMetadataProvider = profileMetadataProvider; _profileValidationReporter = profileValidationReporter; - _resourceModel = new Lazy(resourceModelProvider.GetResourceModel); + _resourceModel = new Lazy(resourceModelProvider.GetResourceModel); } public ProfileResourceModel GetProfileResourceModel(string profileName) diff --git a/Application/EdFi.Ods.Common/Models/Resource/ProfileResourceModel.cs b/Application/EdFi.Ods.Common/Models/Resource/ProfileResourceModel.cs index 0735a2e1ae..77590bfc41 100644 --- a/Application/EdFi.Ods.Common/Models/Resource/ProfileResourceModel.cs +++ b/Application/EdFi.Ods.Common/Models/Resource/ProfileResourceModel.cs @@ -32,7 +32,7 @@ public class ProfileResourceModel /// The backing for the Profile-constrained model. /// The Profile definition which is to be used to constraint the Resource model. /// - public ProfileResourceModel(ResourceModel resourceModel, XElement profileDefinition, IProfileValidationReporter profileValidationReporter) + public ProfileResourceModel(IResourceModel resourceModel, XElement profileDefinition, IProfileValidationReporter profileValidationReporter) { ResourceModel = resourceModel; @@ -61,7 +61,7 @@ public ProfileResourceModel(ResourceModel resourceModel, XElement profileDefinit public IReadOnlyList Resources => ResourceByName.Values.ToList(); - internal ResourceModel ResourceModel { get; } + internal IResourceModel ResourceModel { get; } public Resource GetResourceByName(FullName resourceName) { @@ -86,7 +86,7 @@ public bool ResourceIsWritable(FullName resourceName) => ResourceByName.Any( /// /// /// - private Dictionary CreateResourceByName(ResourceModel resourceModel, Func createKey) + private Dictionary CreateResourceByName(IResourceModel resourceModel, Func createKey) { var resourceElts = _profileDefinition.Elements("Resource"); @@ -108,7 +108,7 @@ private Dictionary CreateResourceByName(R // Use the direct/default resource selector on the resource model because we need the main resource, not the contextual one var fullName = new FullName(physicalName, resourceName); - var sourceResource = ResourceModel.DefaultResourceSelector.GetByName(fullName); + var sourceResource = (ResourceModel as IHasDefaultResourceSelector).DefaultResourceSelector.GetByName(fullName); resources[createKey(sourceResource)] = new ProfileResourceContentTypes(sourceResource, resourceElt, _profileValidationReporter); }); diff --git a/Application/EdFi.Ods.Common/Models/Resource/ProfilesAppliedResourceModel.cs b/Application/EdFi.Ods.Common/Models/Resource/ProfilesAppliedResourceModel.cs index 0667fbad3d..a0c0da3dfa 100644 --- a/Application/EdFi.Ods.Common/Models/Resource/ProfilesAppliedResourceModel.cs +++ b/Application/EdFi.Ods.Common/Models/Resource/ProfilesAppliedResourceModel.cs @@ -22,7 +22,7 @@ public class ProfilesAppliedResourceModel : IResourceModel, IDisposable // NOTE: This should be used as a transient object, or the Lazy implementation of the _underlyingResourceModel assignment will need to be reworked. private readonly ProfilesAppliedResourceSelector _resourceSelector; - private readonly ResourceModel _backingResourceModel; + private readonly IResourceModel _backingResourceModel; public ProfilesAppliedResourceModel( ContentTypeUsage usage, diff --git a/Application/EdFi.Ods.Common/Models/Resource/ResourceModel.cs b/Application/EdFi.Ods.Common/Models/Resource/ResourceModel.cs index 74c377e9e0..8fa126036c 100644 --- a/Application/EdFi.Ods.Common/Models/Resource/ResourceModel.cs +++ b/Application/EdFi.Ods.Common/Models/Resource/ResourceModel.cs @@ -62,11 +62,24 @@ public interface IHasContextualResourceSelector IResourceSelector SetContextualResourceSelector(IResourceSelector contextualResourceSelector); } - public class ResourceModel : IResourceModel, IHasContextualResourceSelector + /// + /// Defines a property for obtaining the default resource model. + /// + public interface IHasDefaultResourceSelector + { + /// + /// Gets the default , providing access to the underlying model. + /// + /// The default , providing access to the underlying model. + IResourceSelector DefaultResourceSelector { get; } + } + + public class ResourceModel : IResourceModel, IHasContextualResourceSelector, IHasDefaultResourceSelector { private const string ResourceSelectorKey = "ResourceModel.ResourcesSelector"; private readonly DomainModel _domainModel; private readonly IDictionary _resourceByName; + private readonly IResourceSelector _defaultResourceSelector; public ResourceModel(DomainModel domainModel) { @@ -78,20 +91,18 @@ public ResourceModel(DomainModel domainModel) .Entities .Where(a => a.IsAggregateRoot) .ForEach(AddResource); - - DefaultResourceSelector = new ResourceSelector(_resourceByName); + + _defaultResourceSelector = new ResourceSelector(_resourceByName); } - internal IResourceSelector DefaultResourceSelector { get; } + IResourceSelector IHasDefaultResourceSelector.DefaultResourceSelector + { + get => _defaultResourceSelector; + } private IResourceSelector ResourceSelector { - get - { - return - (IResourceSelector) CallContext.GetData(ResourceSelectorKey) - ?? DefaultResourceSelector; - } + get => (IResourceSelector) CallContext.GetData(ResourceSelectorKey) ?? _defaultResourceSelector; } /// @@ -102,7 +113,7 @@ IResourceSelector IHasContextualResourceSelector.SetContextualResourceSelector(I { CallContext.SetData(ResourceSelectorKey, resourceSelector); - return DefaultResourceSelector; + return _defaultResourceSelector; } /// diff --git a/Application/EdFi.Ods.Common/Models/Resource/ResourceModelProvider.cs b/Application/EdFi.Ods.Common/Models/Resource/ResourceModelProvider.cs index 8f8ffd1429..0a3f732d79 100644 --- a/Application/EdFi.Ods.Common/Models/Resource/ResourceModelProvider.cs +++ b/Application/EdFi.Ods.Common/Models/Resource/ResourceModelProvider.cs @@ -21,7 +21,7 @@ public ResourceModelProvider(IDomainModelProvider domainModelProvider) _resourceModel = new Lazy(() => new ResourceModel(domainModel.Value)); } - public ResourceModel GetResourceModel() + public IResourceModel GetResourceModel() { return _resourceModel.Value; } diff --git a/Application/EdFi.Ods.Common/Models/ResourceModelHelper.cs b/Application/EdFi.Ods.Common/Models/ResourceModelHelper.cs index 217cc93130..7c252d8f36 100644 --- a/Application/EdFi.Ods.Common/Models/ResourceModelHelper.cs +++ b/Application/EdFi.Ods.Common/Models/ResourceModelHelper.cs @@ -17,6 +17,6 @@ public static class ResourceModelHelper /// /// Returns the resource model from the container. /// - public static Lazy ResourceModel; + public static Lazy ResourceModel; } } diff --git a/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationFilterContext.cs b/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationFilterContext.cs index 6792b2fe47..1e65a57037 100644 --- a/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationFilterContext.cs +++ b/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationFilterContext.cs @@ -4,6 +4,7 @@ // See the LICENSE and NOTICES files in the project root for more information. using System; +using System.Collections.Generic; using System.Linq; using EdFi.Ods.Common.Infrastructure.Filtering; @@ -16,15 +17,59 @@ namespace EdFi.Ods.Common.Security.Authorization /// public class AuthorizationFilterContext { + private string _subjectEndpointName; + private string[] _subjectEndpointNames; + private object _subjectEndpointValue; + private IList _subjectEndpointValues; + /// /// Get or sets the name of the filter definition as defined by an implementation. /// public string FilterName { get; set; } - + /// /// The name of the property that is the subject of the authorization filter (may contain a role name). /// - public string SubjectEndpointName { get; set; } + /// This property is retained for backwards compatibility with authorization scenarios that already exist + /// that were designed to support a single authorization subject endpoint. Use the property + /// which uses and array for future implementations. + public string SubjectEndpointName + { + get + { + // Ensure an error occurs if the single-endpoint property is requested and a multi-item array has been set + return _subjectEndpointName ?? _subjectEndpointNames?.SingleOrDefault(); + } + set + { + if (_subjectEndpointNames != null) + { + throw new InvalidOperationException("Cannot set SubjectEndpointName when SubjectEndpointNames is already set."); + } + + _subjectEndpointName = value; + } + } + + /// + /// The names of the properties that are the subject of the authorization filter (may contain a role names). + /// + public string[] SubjectEndpointNames + { + get + { + return _subjectEndpointNames ?? new[] { _subjectEndpointName }; + } + set + { + if (_subjectEndpointName != null) + { + throw new InvalidOperationException("Cannot set SubjectEndpointNames when SubjectEndpointName is already set."); + } + + _subjectEndpointNames = value; + } + } /// /// The name of the parameter representing a claim value held by the API client to be used in the query against the authorization view. @@ -41,7 +86,8 @@ public class AuthorizationFilterContext /// /// The database parameter values associated with the API client's claim(s). /// - public object[] ClaimParameterValues { + public object[] ClaimParameterValues + { get { if (_claimParameterValues == null) @@ -68,6 +114,54 @@ public object[] ClaimParameterValues { /// /// For single item authorization scenarios, gets or sets the value associated with the subject endpoint for authorization. /// - public object SubjectEndpointValue { get; set; } + /// This property is retained for backwards compatibility with authorization scenarios that already exist + /// that were designed to support a single authorization subject endpoint. Use the property + /// which uses and array for future implementations. + public object SubjectEndpointValue + { + get + { + if (_subjectEndpointValues != null) + { + throw new InvalidOperationException("Cannot use SubjectEndpointValue when SubjectEndpointValues is already set."); + } + + return _subjectEndpointValue; + } + set + { + if (_subjectEndpointValues != null) + { + throw new InvalidOperationException("Cannot set SubjectEndpointValue when SubjectEndpointValues is already set."); + } + + _subjectEndpointValue = value; + } + } + + /// + /// For single item authorization scenarios, gets or sets the values associated with the subject endpoints for authorization. + /// + public IList SubjectEndpointValues + { + get + { + if (_subjectEndpointValue != null) + { + throw new InvalidOperationException("Cannot use SubjectEndpointValues when SubjectEndpointValue is already set."); + } + + return _subjectEndpointValues; + } + set + { + if (_subjectEndpointValue != null) + { + throw new InvalidOperationException("Cannot set SubjectEndpointValues when SubjectEndpointValue is already set."); + } + + _subjectEndpointValues = value; + } + } } -} \ No newline at end of file +} diff --git a/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationStrategyFiltering.cs b/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationStrategyFiltering.cs index d7b45268bd..57bd7b3d37 100644 --- a/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationStrategyFiltering.cs +++ b/Application/EdFi.Ods.Common/Security/Authorization/AuthorizationStrategyFiltering.cs @@ -14,6 +14,8 @@ public class AuthorizationStrategyFiltering /// public string AuthorizationStrategyName { get; init; } + public IAuthorizationStrategy AuthorizationStrategy { get; init; } + /// /// Gets or sets the filters to be applied. /// diff --git a/Application/EdFi.Ods.Common/Security/Authorization/CustomViewBasedAuthorizationStrategy.cs b/Application/EdFi.Ods.Common/Security/Authorization/CustomViewBasedAuthorizationStrategy.cs new file mode 100644 index 0000000000..24e13f732b --- /dev/null +++ b/Application/EdFi.Ods.Common/Security/Authorization/CustomViewBasedAuthorizationStrategy.cs @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: Apache-2.0 +// Licensed to the Ed-Fi Alliance under one or more agreements. +// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. +// See the LICENSE and NOTICES files in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using EdFi.Ods.Common.Models; +using EdFi.Ods.Common.Models.Domain; +using EdFi.Ods.Common.Security.Claims; + +namespace EdFi.Ods.Common.Security.Authorization; + +public class CustomViewBasedAuthorizationStrategy : IAuthorizationStrategy +{ + private readonly string _authorizationStrategyName; + private readonly Entity _basisEntity; + private readonly IResourceClaimUriProvider _resourceClaimUriProvider; + private readonly IResourceModelProvider _resourceModelProvider; + + public CustomViewBasedAuthorizationStrategy( + string authorizationStrategyName, + Entity basisEntity, + IResourceClaimUriProvider resourceClaimUriProvider, + IResourceModelProvider resourceModelProvider) + { + _authorizationStrategyName = authorizationStrategyName; + _basisEntity = basisEntity; + _resourceClaimUriProvider = resourceClaimUriProvider; + _resourceModelProvider = resourceModelProvider; + } + + public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( + EdFiResourceClaim[] relevantClaims, + EdFiAuthorizationContext authorizationContext) + { + var subjectEntity = GetAuthorizationSubjectEntity(); + + List subjectEndpointNames = GetAuthorizationSubjectEndpointNames(); + + return new AuthorizationStrategyFiltering() + { + AuthorizationStrategy = this, + AuthorizationStrategyName = _authorizationStrategyName, + Filters = new AuthorizationFilterContext[] + { + new () + { + FilterName = _authorizationStrategyName, + SubjectEndpointNames = subjectEndpointNames.ToArray(), + SubjectEndpointValues = authorizationContext.Data == null + ? null + : subjectEndpointNames.Select( + n => authorizationContext.Type.GetProperty(n).GetValue(authorizationContext.Data)) + .ToList(), + ClaimParameterName = null, + ClaimEndpointValues = null, + } + }, + Operator = FilterOperator.And + }; + + List GetAuthorizationSubjectEndpointNames() + { + var endpointNames = new List(); + + // First try to find properties by name in subject + foreach (EntityProperty basisProperty in _basisEntity.Identifier.Properties) + { + if (subjectEntity.PropertyByName.TryGetValue(basisProperty.PropertyName, out var subjectEntityProperty)) + { + endpointNames.Add(subjectEntityProperty.PropertyName); + continue; + } + + // Search for a locally role-named property using the incoming associations in the model back to the basis entity + var roleNamedSubjectEndpointProperty = subjectEntity.Properties.FirstOrDefault(p => p.DefiningProperty == basisProperty); + + if (roleNamedSubjectEndpointProperty != null) + { + endpointNames.Add(roleNamedSubjectEndpointProperty.PropertyName); + continue; + } + + throw new Exception( + $"Unable to find a property on the authorization subject entity type '{subjectEntity.Name}' corresponding to the '{basisProperty.PropertyName}' property on the custom authorization view's basis entity type '{_basisEntity.Name}' in order to perform authorization. Should a different authorization strategy be used?"); + } + + return endpointNames; + } + + Entity GetAuthorizationSubjectEntity() + { + var resourceFullName = _resourceClaimUriProvider.GetResourceFullName(authorizationContext.ResourceClaimUris); + var subjectResource = _resourceModelProvider.GetResourceModel().GetResourceByFullName(resourceFullName); + return subjectResource.Entity; + } + } + + public Entity BasisEntity + { + get => _basisEntity; + } +} diff --git a/Application/EdFi.Ods.Common/Security/Authorization/IAuthorizationStrategy.cs b/Application/EdFi.Ods.Common/Security/Authorization/IAuthorizationStrategy.cs index cc33b73b0e..06256d6928 100644 --- a/Application/EdFi.Ods.Common/Security/Authorization/IAuthorizationStrategy.cs +++ b/Application/EdFi.Ods.Common/Security/Authorization/IAuthorizationStrategy.cs @@ -3,10 +3,6 @@ // The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. // See the LICENSE and NOTICES files in the project root for more information. -using System.Collections.Generic; -using System.Security.Claims; -using System.Threading; -using System.Threading.Tasks; using EdFi.Ods.Common.Security.Claims; namespace EdFi.Ods.Common.Security.Authorization diff --git a/Application/EdFi.Ods.Api/Security/Authorization/IResourceClaimUriProvider.cs b/Application/EdFi.Ods.Common/Security/Authorization/IResourceClaimUriProvider.cs similarity index 70% rename from Application/EdFi.Ods.Api/Security/Authorization/IResourceClaimUriProvider.cs rename to Application/EdFi.Ods.Common/Security/Authorization/IResourceClaimUriProvider.cs index a51c95bcc2..f82f8fefc9 100644 --- a/Application/EdFi.Ods.Api/Security/Authorization/IResourceClaimUriProvider.cs +++ b/Application/EdFi.Ods.Common/Security/Authorization/IResourceClaimUriProvider.cs @@ -4,9 +4,10 @@ // See the LICENSE and NOTICES files in the project root for more information. using System; +using EdFi.Ods.Common.Models.Domain; using EdFi.Ods.Common.Models.Resource; -namespace EdFi.Ods.Api.Security.Authorization +namespace EdFi.Ods.Common.Security.Authorization { /// /// Defines methods for obtaining resource claim URIs used for authorization. @@ -26,5 +27,12 @@ public interface IResourceClaimUriProvider /// The for which to build the resource claim URIs. /// The resource URIs. string[] GetResourceClaimUris(Resource resource); + + /// + /// Gets the full name of the resource associated with the specified resource claim URIs. + /// + /// The resource claim URIs for which the associated resource name is to be obtained. + /// The of the resource associated with the supplied resource claim URIs. + FullName GetResourceFullName(string[] resourceClaimUris); } } diff --git a/Application/EdFi.Ods.Common/Security/CustomViewBased/CustomViewHelpers.cs b/Application/EdFi.Ods.Common/Security/CustomViewBased/CustomViewHelpers.cs new file mode 100644 index 0000000000..11f2ea5934 --- /dev/null +++ b/Application/EdFi.Ods.Common/Security/CustomViewBased/CustomViewHelpers.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Concurrent; +using EdFi.Ods.Common.Caching; +using EdFi.Ods.Common.Infrastructure.Interceptors; +using Standart.Hash.xxHash; + +namespace EdFi.Ods.Common.Security.CustomViewBased; + +public static class CustomViewHelpers +{ + private static readonly ConcurrentDictionary _authViewAliasPrefixByName = new(); + private static readonly ConcurrentDictionary _viewNameByAuthViewAliasPrefix = new(); + + public const string CustomViewAliasPrefixBase = "acvw_"; + + /// + /// Gets a unique alias prefix to be used with the supplied view name to help identify it in the database engine-specific + /// SQL produced by NHibernate for subsequent manipulation by the . + /// + /// The name of the view to be aliased. + /// The view-specific alias prefix for use in SQL generation. + public static string GetAliasPrefix(string viewName) + { + string aliasPrefix = _authViewAliasPrefixByName.GetOrAdd( + viewName, + vn => + { + var bytes = viewName.GetBytes(); + uint hash = xxHash32.ComputeHash(bytes, bytes.Length); + + uint hashShort = (ushort)(hash & 0xFFFF); + string prefix = $"{CustomViewAliasPrefixBase}{hashShort:x}_"; + + // Add the reverse entry + _viewNameByAuthViewAliasPrefix.TryAdd(prefix, vn); + + return prefix; + }); + + return aliasPrefix; + } + + /// + /// Performs a reverse lookup for a previously generated view-specific alias prefix. + /// + /// The alias prefix for which the corresponding view name should be returned. + /// The view name corresponding to the supplied alias prefix. + /// Occurs when the view name cannot be identified for the supplied alias prefix. + public static string GetViewName(string aliasPrefix) + { + if (_viewNameByAuthViewAliasPrefix.TryGetValue(aliasPrefix, out string viewName)) + { + return viewName; + } + + throw new Exception($"Unable to find view name for alias prefix '{aliasPrefix}'."); + } +} diff --git a/Application/EdFi.Ods.Features/ChangeQueries/Controllers/DeletesController.cs b/Application/EdFi.Ods.Features/ChangeQueries/Controllers/DeletesController.cs index 7a412aa033..f04bc208f9 100644 --- a/Application/EdFi.Ods.Features/ChangeQueries/Controllers/DeletesController.cs +++ b/Application/EdFi.Ods.Features/ChangeQueries/Controllers/DeletesController.cs @@ -9,7 +9,6 @@ using EdFi.Ods.Api.Attributes; using EdFi.Ods.Api.Constants; using EdFi.Ods.Api.Helpers; -using EdFi.Ods.Api.Security.Authorization; using EdFi.Ods.Common.Configuration; using EdFi.Ods.Common.Constants; using EdFi.Ods.Common.Exceptions; @@ -18,6 +17,7 @@ using EdFi.Ods.Common.Models; using EdFi.Ods.Common.Models.Queries; using EdFi.Ods.Common.Models.Validation; +using EdFi.Ods.Common.Security.Authorization; using EdFi.Ods.Common.Security.Claims; using EdFi.Ods.Common.Serialization; using EdFi.Ods.Features.ChangeQueries.Repositories.DeletedItems; diff --git a/Application/EdFi.Ods.Features/ChangeQueries/Controllers/KeyChangesController.cs b/Application/EdFi.Ods.Features/ChangeQueries/Controllers/KeyChangesController.cs index 1df1f8c55d..fe069fe274 100644 --- a/Application/EdFi.Ods.Features/ChangeQueries/Controllers/KeyChangesController.cs +++ b/Application/EdFi.Ods.Features/ChangeQueries/Controllers/KeyChangesController.cs @@ -9,7 +9,6 @@ using EdFi.Ods.Api.Attributes; using EdFi.Ods.Api.Constants; using EdFi.Ods.Api.Helpers; -using EdFi.Ods.Api.Security.Authorization; using EdFi.Ods.Common.Configuration; using EdFi.Ods.Common.Constants; using EdFi.Ods.Common.Exceptions; @@ -18,6 +17,7 @@ using EdFi.Ods.Common.Models; using EdFi.Ods.Common.Models.Queries; using EdFi.Ods.Common.Models.Validation; +using EdFi.Ods.Common.Security.Authorization; using EdFi.Ods.Common.Security.Claims; using EdFi.Ods.Common.Serialization; using EdFi.Ods.Features.ChangeQueries.Repositories.KeyChanges; diff --git a/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderModule.cs b/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderModule.cs index 353c283cf0..e7e987d261 100644 --- a/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderModule.cs +++ b/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderModule.cs @@ -5,18 +5,20 @@ using Autofac; using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; +using log4net; namespace EdFi.Ods.Standard.Container.Modules { public class RelationshipsAuthorizationContextDataProviderModule : Module { + private readonly ILog _logger = LogManager.GetLogger(typeof(RelationshipsAuthorizationContextDataProviderModule)); + protected override void Load(ContainerBuilder builder) { - builder.RegisterAssemblyOpenGenericTypes(typeof(Marker_EdFi_Ods_Standard).Assembly) + builder.RegisterAssemblyTypes(typeof(Marker_EdFi_Ods_Standard).Assembly) .Where(t => - // Avoid registering any overrides here t.Namespace?.Contains(".Overrides") != true - && t.IsAssignableTo>()) + && t.IsAssignableTo()) .AsImplementedInterfaces() .SingleInstance(); } diff --git a/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs b/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs index 2d249e40cf..b8750e7f09 100644 --- a/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs +++ b/Application/EdFi.Ods.Standard/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs @@ -16,20 +16,20 @@ protected override void Load(ContainerBuilder builder) { // Establish authorization context for OrganizationDepartments using the ParentEducationOrganization // rather than default behavior (EducationOrganizationId) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); // Establish authorization context for DisciplineActions using the ResponsibilitySchoolId and StudentUSI // rather than default behavior (StudentUSI) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); // Establish authorization context for StudentAssessment using the ReportedSchoolId and StudentUSI rather than // using the default convention (only StudentUSI) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); } } diff --git a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/DisciplineActionRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/DisciplineActionRelationshipsAuthorizationContextDataProvider.cs index de6ca901e9..3cdd3f2405 100644 --- a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/DisciplineActionRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/DisciplineActionRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.DisciplineAction table of the DisciplineAction aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IDisciplineAction resource) + public RelationshipsAuthorizationContextData GetContextData(IDisciplineAction resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'disciplineAction' resource for obtaining authorization context data cannot be null."); var entity = resource as DisciplineAction; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // AssignmentSchoolId = entity.AssignmentSchoolId, // Role name applied and not part of primary key contextData.SchoolId = entity.ResponsibilitySchoolId; // Role name applied and not part of primary key contextData.StudentUSI = entity.StudentUSI == default ? null : entity.StudentUSI; // Primary key property, USI @@ -53,7 +52,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((DisciplineAction)resource); } diff --git a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/OrganizationDepartmentRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/OrganizationDepartmentRelationshipsAuthorizationContextDataProvider.cs index 31331f8bc2..b8085b5d98 100644 --- a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/OrganizationDepartmentRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/OrganizationDepartmentRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.OrganizationDepartment table of the OrganizationDepartment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IOrganizationDepartment resource) + public RelationshipsAuthorizationContextData GetContextData(IOrganizationDepartment resource) { if (resource == null) throw new ArgumentNullException(nameof(resource), "The 'organizationDepartment' resource for obtaining authorization context data cannot be null."); var entity = resource as OrganizationDepartment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // contextData.OrganizationDepartmentId = entity.OrganizationDepartmentId == default(int) ? null as int? : entity.OrganizationDepartmentId; // Primary key property, Only Education Organization Id present contextData.EducationOrganizationId = entity.ParentEducationOrganizationId; // Role name applied and not part of primary key return contextData; @@ -51,7 +50,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((OrganizationDepartment)resource); } diff --git a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/StudentAssessmentRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/StudentAssessmentRelationshipsAuthorizationContextDataProvider.cs index 4dc79ae3ea..6d467db08c 100644 --- a/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/StudentAssessmentRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Security/Authorization/Overrides/StudentAssessmentRelationshipsAuthorizationContextDataProvider.cs @@ -15,13 +15,12 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAssessment table of the StudentAssessment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAssessment resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAssessment resource) { if (resource == null) { @@ -30,7 +29,7 @@ public TContextData GetContextData(IStudentAssessment resource) var entity = resource as StudentAssessment; - var contextData = new TContextData + var contextData = new RelationshipsAuthorizationContextData { SchoolId = entity.ReportedSchoolId, // Role name applied and not part of primary key StudentUSI = entity.StudentUSI == default ? null : entity.StudentUSI // Primary key property, USI @@ -56,7 +55,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAssessment)resource); } diff --git a/Application/EdFi.Ods.Standard/Standard/5.1.0/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs b/Application/EdFi.Ods.Standard/Standard/5.1.0/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs index f2544766a9..32aa8eb031 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.1.0/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs +++ b/Application/EdFi.Ods.Standard/Standard/5.1.0/Container/Modules/RelationshipsAuthorizationContextDataProviderOverridesModule.cs @@ -16,26 +16,26 @@ protected override void Load(ContainerBuilder builder) { // Establish authorization context for EvaluationRubricDimension using the ProgramEducationOrganizationId rather than // using the default behavior (EducationOrganizationId) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); // Establish authorization context for StudentAssessment using the ProgramEducationOrganizationId rather than // using the default behavior (EducationOrganizationId) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); // Establish authorization context for StudentAssessment using the ProgramEducationOrganizationId rather than // using the default behavior (EducationOrganizationId) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); // Establish authorization context for StudentAssessment using the ProgramEducationOrganizationId rather than // using the default behavior (EducationOrganizationId) - builder.RegisterType>() - .As>() + builder.RegisterType() + .As>() .SingleInstance(); } } diff --git a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider.cs index 84fe6b5346..60a0fcec9b 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.EvaluationRubricDimension table of the EvaluationRubricDimension aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationRubricDimension resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationRubricDimension resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationRubricDimension' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationRubricDimension; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.ProgramEducationOrganizationId; return contextData; @@ -50,7 +49,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationRubricDimension)resource); } diff --git a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider.cs index 418a556721..6b5e19ddee 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluationElement table of the ProgramEvaluationElement aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluationElement resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluationElement resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluationElement' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluationElement; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.ProgramEducationOrganizationId; return contextData; @@ -50,7 +49,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluationElement)resource); } diff --git a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider.cs index 54abf8c57f..2443d27789 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluationObjective table of the ProgramEvaluationObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluationObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluationObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluationObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluationObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.ProgramEducationOrganizationId; return contextData; @@ -50,7 +49,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluationObjective)resource); } diff --git a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationRelationshipsAuthorizationContextDataProvider.cs b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationRelationshipsAuthorizationContextDataProvider.cs index 952f8ec6ae..c3ad1da699 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationRelationshipsAuthorizationContextDataProvider.cs +++ b/Application/EdFi.Ods.Standard/Standard/5.1.0/Security/Authorization/Overrides/ProgramEvaluationRelationshipsAuthorizationContextDataProvider.cs @@ -15,20 +15,19 @@ namespace EdFi.Ods.Standard.Security.Authorization.Overrides /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluation table of the ProgramEvaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.ProgramEducationOrganizationId; return contextData; @@ -50,7 +49,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluation)resource); } diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetdataSelectorTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetdataSelectorTests.cs index bfc73f93d2..220626c2f4 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetdataSelectorTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/AuthorizationBasisMetdataSelectorTests.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using EdFi.Ods.Api.Security.Authorization; +using EdFi.Ods.Api.Security.AuthorizationStrategies; using EdFi.Ods.Api.Security.Claims; using EdFi.Ods.Common.Exceptions; using EdFi.Ods.Common.Security; @@ -89,11 +90,9 @@ public void SetUp() _claimSetClaimsProvider = A.Fake(); - _suppliedAuthorizationStrategies = new IAuthorizationStrategy[] - { - _fake1AuthorizationStrategy, - _fake2AuthorizationStrategy - }; + var authorizationStrategyProvider = A.Fake(); + A.CallTo(() => authorizationStrategyProvider.GetByName(A.That.IsEqualTo("Fake1", StringComparer.OrdinalIgnoreCase))).Returns(_fake1AuthorizationStrategy); + A.CallTo(() => authorizationStrategyProvider.GetByName(A.That.IsEqualTo("Fake2", StringComparer.OrdinalIgnoreCase))).Returns(_fake2AuthorizationStrategy); _suppliedApiClientContext = new ApiClientContext("API_KEY", SuppliedClaimSetName, @@ -109,8 +108,8 @@ public void SetUp() _authorizationBasisMetadataSelector = new AuthorizationBasisMetadataSelector( _resourceAuthorizationMetadataProvider, _securityRepository, - _suppliedAuthorizationStrategies, - _claimSetClaimsProvider); + _claimSetClaimsProvider, + new[]{ authorizationStrategyProvider }); } private static IEnumerable GetActionScenarios() @@ -250,6 +249,7 @@ private static EdFiResourceClaimValue Actions(bool create = false, bool read = f return new EdFiResourceClaimValue() { Actions = resourceActions.ToArray() }; } + [AuthorizationStrategyName("Fake1")] private class Fake1AuthorizationStrategy : IAuthorizationStrategy { public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( @@ -258,6 +258,7 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( => new(); } + [AuthorizationStrategyName("Fake2")] private class Fake2AuthorizationStrategy : IAuthorizationStrategy { public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProviderTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProviderTests.cs index 5ffd75d2a9..6cca225cae 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProviderTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Api/Security/Authorization/ResourceClaimUriProviderTests.cs @@ -9,6 +9,7 @@ using EdFi.Ods.Api.Security.Authorization; using EdFi.Ods.Common; using EdFi.Ods.Common.Conventions; +using EdFi.Ods.Common.Models; using EdFi.Ods.Common.Models.Domain; using EdFi.Ods.Common.Models.Resource; using FakeItEasy; @@ -22,12 +23,21 @@ public class ResourceClaimUriProviderTests { private ISchemaNameMapProvider _schemaNameMapProvider; private ResourceClaimUriProvider _uriProvider; + private IResourceModelProvider _resourceModelProvider; [SetUp] public void SetUp() { _schemaNameMapProvider = A.Fake(); - _uriProvider = new ResourceClaimUriProvider(_schemaNameMapProvider); + + + var resourceModel = A.Fake(); + A.CallTo(() => resourceModel.GetAllResources()).Returns(Array.Empty()); + + _resourceModelProvider = A.Fake(); + A.CallTo(() => _resourceModelProvider.GetResourceModel()).Returns(resourceModel); + + _uriProvider = new ResourceClaimUriProvider(_schemaNameMapProvider, _resourceModelProvider); } [Test] @@ -39,7 +49,25 @@ public void GetResourceClaimUris_WithNullResourceType_ShouldThrowArgumentNullExc } [Test] - public void GetResourceClaimUris_CallsGetResourceClaimUrisWithType_ReturnsResourceClaimUriAndLegacyResourceClaimUri() + public void GetResourceClaimUris_CallsGetResourceClaimUrisWithEdFiStandardResourceType_ReturnsResourceClaimUriAndLegacyResourceClaimUri() + { + // Arrange + var resourceType = typeof(global::EdFi.Ods.Api.Common.Models.Resources.EdFiResource.EdFi.TestResource); + var schemaNameMap = new SchemaNameMap(EdFiConventions.LogicalName, EdFiConventions.PhysicalSchemaName, EdFiConventions.UriSegment, EdFiConventions.ProperCaseName); + A.CallTo(() => _schemaNameMapProvider.GetSchemaMapByProperCaseName("EdFi")) + .Returns(schemaNameMap); + + // Act + var uris = _uriProvider.GetResourceClaimUris(resourceType); + + // Assert + uris.Length.ShouldBe(2); + uris[0].ShouldBe("http://ed-fi.org/ods/identity/claims/ed-fi/testResource"); + uris[1].ShouldBe("http://ed-fi.org/ods/identity/claims/testResource"); + } + + [Test] + public void GetResourceClaimUris_CallsGetResourceClaimUrisWithExtensionType_ReturnsResourceClaimUriAndLegacyResourceClaimUri() { // Arrange var resourceType = typeof(global::EdFi.Ods.Api.Common.Models.Resources.TestResource.TestSchema.TestResource); @@ -51,8 +79,8 @@ public void GetResourceClaimUris_CallsGetResourceClaimUrisWithType_ReturnsResour var uris = _uriProvider.GetResourceClaimUris(resourceType); // Assert + uris.Length.ShouldBe(1); uris[0].ShouldBe("http://ed-fi.org/ods/identity/claims/testSchema/testResource"); - uris[1].ShouldBe("http://ed-fi.org/ods/identity/claims/testResource"); } [Test] @@ -78,3 +106,8 @@ namespace EdFi.Ods.Api.Common.Models.Resources.TestResource.TestSchema { public class TestResource { } } + +namespace EdFi.Ods.Api.Common.Models.Resources.EdFiResource.EdFi +{ + public class TestResource { } +} diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Common/Models/Resource/ResourceChildItemTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Common/Models/Resource/ResourceChildItemTests.cs index 267c692c04..1483786090 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Common/Models/Resource/ResourceChildItemTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Common/Models/Resource/ResourceChildItemTests.cs @@ -20,7 +20,7 @@ public class ResourceChildItemTests public class When_building_a_resource_with_aggregate_extension : TestFixtureBase { - private ResourceModel _resourceModel; + private IResourceModel _resourceModel; private global::EdFi.Ods.Common.Models.Resource.Resource _student; private ResourceChildItem _studentExtension; private ResourceChildItem _studentPet; diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/EdFiAuthorizationProviderTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/EdFiAuthorizationProviderTests.cs index 34e9b60168..4fd4b9334f 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/EdFiAuthorizationProviderTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/EdFiAuthorizationProviderTests.cs @@ -7,10 +7,12 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Reflection; using System.Threading; using EdFi.Ods.Api.Security.Authorization; using EdFi.Ods.Api.Security.Authorization.Filtering; using EdFi.Ods.Api.Security.Authorization.Repositories; +using EdFi.Ods.Api.Security.AuthorizationStrategies; using EdFi.Ods.Api.Security.AuthorizationStrategies.NoFurtherAuthorization; using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships; using EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters; @@ -119,15 +121,15 @@ public static EntityAuthorizer CreateEntityAuthorizer( public static AuthorizationBasisMetadataSelector CreateAuthorizationBasisMetadataSelector( IResourceAuthorizationMetadataProvider resourceAuthorizationMetadataProvider = null, ISecurityRepository securityRepository = null, - IAuthorizationStrategy[] authorizationStrategies = null, + IAuthorizationStrategyProvider[] authorizationStrategyProviders = null, IClaimSetClaimsProvider claimSetClaimsProvider = null ) { return new AuthorizationBasisMetadataSelector( resourceAuthorizationMetadataProvider ?? A.Fake(), securityRepository ?? A.Fake(), - authorizationStrategies ?? A.CollectionOfFake(0).ToArray(), - claimSetClaimsProvider ?? A.Fake()); + claimSetClaimsProvider ?? A.Fake(), + authorizationStrategyProviders ?? A.CollectionOfFake(0).ToArray()); } public static EdFiResourceClaim CreateResourceClaim(string resourceClaimUri, @@ -269,6 +271,7 @@ public void Should_throw_an_AuthorizationContextException() [TestFixture] public class Feature_Validating_authorization_strategy_naming_conventions { + // No authorization strategy name metadata here private class AuthorizationStrategyNotFollowingConventions : IAuthorizationStrategy { public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering(EdFiResourceClaim[] relevantClaims, EdFiAuthorizationContext authorizationContext) @@ -277,6 +280,7 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering(EdFiReso } } + [AuthorizationStrategyName("ConventionFollowing")] private class ConventionFollowingAuthorizationStrategy : IAuthorizationStrategy { public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering(EdFiResourceClaim[] relevantClaims, EdFiAuthorizationContext authorizationContext) @@ -285,6 +289,7 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering(EdFiReso } } + [AuthorizationStrategyName("Convention2Following")] private class Convention2FollowingAuthorizationStrategy : ConventionFollowingAuthorizationStrategy { } @@ -295,8 +300,16 @@ public abstract class When_creating_the_authorization_provider : TestFixtureBase protected override void Act() { - var selector = Helper.CreateAuthorizationBasisMetadataSelector( - authorizationStrategies: AuthorizationStrategies); + var authorizationStrategyProvider = A.Fake(); + + foreach (var authorizationStrategy in AuthorizationStrategies) + { + var nameAttribute = authorizationStrategy.GetType().GetCustomAttribute(); + A.CallTo(() => authorizationStrategyProvider.GetByName(nameAttribute.Name)).Returns(authorizationStrategy); + } + + var ignored = Helper.CreateAuthorizationBasisMetadataSelector( + authorizationStrategyProviders: new[] { authorizationStrategyProvider }); } protected void Given_a_collection_of_authorizationStrategies(IAuthorizationStrategy[] authorizationStrategies) @@ -323,26 +336,6 @@ public void Should_not_throw_an_exception() ActualException.ShouldBeNull(); } } - - public class When_creating_the_authorization_provider_with_an_authorization_strategy_type_whose_name_does_not_end_with_AuthorizationStrategy - : When_creating_the_authorization_provider - { - protected override void Arrange() - { - Given_a_collection_of_authorizationStrategies(new IAuthorizationStrategy[] - { - new ConventionFollowingAuthorizationStrategy(), - new AuthorizationStrategyNotFollowingConventions() - }); - } - - [Assert] - public void Should_throw_an_ArgumentException_indicating_that_the_authorization_strategy_doesnt_follow_proper_naming_conventions() - { - ActualException.ShouldBeExceptionType(); - ActualException.Message.ShouldContain(nameof(AuthorizationStrategyNotFollowingConventions)); - } - } } [TestFixture] @@ -368,16 +361,22 @@ public AuthorizationStrategyFiltering GetAuthorizationStrategyFiltering( } } + [AuthorizationStrategyName("Second")] public class SecondAuthorizationStrategy : AuthorizationStrategyBase { } + [AuthorizationStrategyName("AnotherSecond")] public class AnotherSecondAuthorizationStrategy : AuthorizationStrategyBase { } + [AuthorizationStrategyName("Fourth")] public class FourthAuthorizationStrategy : AuthorizationStrategyBase { } + [AuthorizationStrategyName("AnotherFourth")] public class AnotherFourthAuthorizationStrategy : AuthorizationStrategyBase { } + [AuthorizationStrategyName("Override")] public class OverrideAuthorizationStrategy : AuthorizationStrategyBase { } + [AuthorizationStrategyName("AnotherOverride")] public class AnotherOverrideAuthorizationStrategy : AuthorizationStrategyBase { } #endregion @@ -563,11 +562,20 @@ protected virtual void Given_an_authorizationContextProvider(string action, stri protected virtual void Given_an_AuthorizationBasisMetadataSelector() { + var authorizationStrategyProvider = A.Fake(); + + foreach (var authorizationStrategy in AuthorizationStrategies) + { + var nameAttribute = authorizationStrategy.GetType().GetCustomAttribute(); + A.CallTo(() => authorizationStrategyProvider.GetByName(nameAttribute.Name)).Returns(authorizationStrategy); + } + AuthorizationBasisMetadataSelector = new AuthorizationBasisMetadataSelector( ResourceAuthorizationMetadataProvider, SecurityRepository, - AuthorizationStrategies, - ClaimSetClaimsProvider); + ClaimSetClaimsProvider, + new[] { authorizationStrategyProvider } + ); } protected virtual void Given_a_RepositoryOperationAuthorizationDecorator() @@ -1722,6 +1730,7 @@ public void Should_only_attempt_to_authorize_using_the_sole_authorization_strate } // ================ Begin Detecting Missing or Undefined Authorization Strategy Scenarios =============== + [AuthorizationStrategyName("Unused")] public class UnusedAuthorizationStrategy : AuthorizationStrategyBase { } public abstract class When_authorizing_a_request_with_missing_or_undefined_authorization_strategies @@ -1749,14 +1758,15 @@ protected void Given_a_ResourceAuthorizationMetadataProvider(string[] authorizat protected override void Given_an_AuthorizationBasisMetadataSelector() { + var authorizationStrategyProvider = A.Fake(); + A.CallTo(() => authorizationStrategyProvider.GetByName("Unused")).Returns(new UnusedAuthorizationStrategy()); + A.CallTo(() => authorizationStrategyProvider.GetByName(A.Ignored)).Returns(null); + AuthorizationBasisMetadataSelector = new AuthorizationBasisMetadataSelector( ResourceAuthorizationMetadataProvider, SecurityRepository, - new IAuthorizationStrategy[] - { - new UnusedAuthorizationStrategy() - }, - ClaimSetClaimsProvider); + ClaimSetClaimsProvider, + new[] { authorizationStrategyProvider }); } } @@ -1784,8 +1794,8 @@ protected override void Act() [Assert] public void Should_throw_exception_indicating_that_the_authorization_strategy_could_not_be_found() { - ActualException.ShouldBeExceptionType() - .Message.ShouldBe("Could not find authorization implementation for strategy 'Missing' based on naming convention of '{strategyName}AuthorizationStrategy'."); + ActualException.ShouldBeExceptionType() + .Message.ShouldBe("Could not find an authorization strategy implementation for strategy name 'Missing'."); } } @@ -1814,7 +1824,7 @@ protected override void Act() [Assert] public void Should_throw_exception_indicating_that_no_authorization_strategy_were_defined_in_the_metadata() { - ActualException.ShouldBeExceptionType() + ActualException.ShouldBeExceptionType() .Message.ShouldBe($"No authorization strategies were defined for the requested action '{ReadActionUri}' against resource URIs ['{Resource2ClaimUri}'] matched by the caller's claim '{Resource2ClaimUri}'."); } } @@ -1844,7 +1854,7 @@ protected override void Act() [Assert] public void Should_throw_exception_indicating_that_no_authorization_strategy_were_defined_in_the_metadata() { - ActualException.ShouldBeExceptionType() + ActualException.ShouldBeExceptionType() .Message.ShouldBe($"No authorization strategies were defined for the requested action '{ReadActionUri}' against resource URIs ['{Resource2ClaimUri}'] matched by the caller's claim '{Resource2ClaimUri}'."); } } @@ -1948,10 +1958,18 @@ protected override void Arrange() protected override void Act() { + var authorizationStrategyProvider = A.Fake(); + + foreach (var authorizationStrategy in GetAuthorizationStrategies()) + { + var nameAttribute = authorizationStrategy.GetType().GetCustomAttribute(); + A.CallTo(() => authorizationStrategyProvider.GetByName(nameAttribute.Name)).Returns(authorizationStrategy); + } + var authorizationBasisMetadataSelector = Helper.CreateAuthorizationBasisMetadataSelector( _resourceAuthorizationMetadataProvider, _securityRepository, - GetAuthorizationStrategies(), + new []{ authorizationStrategyProvider }, _claimSetClaimsProvider); var entityAuthorizer = Helper.CreateEntityAuthorizer( @@ -2037,12 +2055,12 @@ protected virtual IAuthorizationStrategy[] GetAuthorizationStrategies() { return new IAuthorizationStrategy[] { - new RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy( + new RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy( Stub() ) { RelationshipsAuthorizationContextDataProviderFactory = - Stub>() + Stub() }, new NoFurtherAuthorizationRequiredAuthorizationStrategy() }; diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/NamespaceBasedAuthorizationTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/NamespaceBasedAuthorizationTests.cs index 1072af19dc..64aaebaea3 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/NamespaceBasedAuthorizationTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/NamespaceBasedAuthorizationTests.cs @@ -50,7 +50,7 @@ public void AuthorizationContextNamespaceIsEmpty_ShouldThrowAnException(Authoriz }; //Act - var filterDefinition = filterDefinitionsFactory.CreateAuthorizationFilterDefinitions().Single(); + var filterDefinition = filterDefinitionsFactory.CreatePredefinedAuthorizationFilterDefinitions().Single(); var result = filterDefinition.AuthorizeInstance( new EdFiAuthorizationContext( @@ -103,7 +103,7 @@ public void NonMatchingNamespaceClaims_ShouldThrowAnException(AuthorizationPhase }; //Act - var filterDefinition = filterDefinitionsFactory.CreateAuthorizationFilterDefinitions().Single(); + var filterDefinition = filterDefinitionsFactory.CreatePredefinedAuthorizationFilterDefinitions().Single(); var result = filterDefinition.AuthorizeInstance( new EdFiAuthorizationContext( diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/Repositories/CompositeAuthorizationDecoratorTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/Repositories/CompositeAuthorizationDecoratorTests.cs index 3e79fc7edb..dc253a89e8 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/Repositories/CompositeAuthorizationDecoratorTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/Authorization/Repositories/CompositeAuthorizationDecoratorTests.cs @@ -128,7 +128,7 @@ protected override void Arrange() SuppliedFilterName, // This is how the HQL filter text is now obtained (with elimination of the INHibernateFilterTextProvider) suppliedFilterText, - (criteria, junction, arg3, arg4, arg5) => { }, + (criteria, junction, arg3, arg4, arg5, arg6) => { }, (filterDefinition, filterContext, resource, filterIndex, qb, useOuterJoins) => { }, (ctx1, ctx2, ctx3) => null)); diff --git a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/AuthorizationStrategies/Relationships/AllRelationshipsAuthorizationStrategyTests.cs b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/AuthorizationStrategies/Relationships/AllRelationshipsAuthorizationStrategyTests.cs index 47c7d39f9f..3a01d888bd 100644 --- a/Application/EdFi.Ods.Tests/EdFi.Ods.Security/AuthorizationStrategies/Relationships/AllRelationshipsAuthorizationStrategyTests.cs +++ b/Application/EdFi.Ods.Tests/EdFi.Ods.Security/AuthorizationStrategies/Relationships/AllRelationshipsAuthorizationStrategyTests.cs @@ -24,19 +24,19 @@ namespace EdFi.Ods.Tests.EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships { - using context_data_provider = IRelationshipsAuthorizationContextDataProvider; - using context_data_provider_factory = IRelationshipsAuthorizationContextDataProviderFactory; + using context_data_provider = IRelationshipsAuthorizationContextDataProvider; + using context_data_provider_factory = IRelationshipsAuthorizationContextDataProviderFactory; // Dependency type aliases (for readability) - using edorgs_and_people_strategy = RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy; + using edorgs_and_people_strategy = RelationshipsWithEdOrgsAndPeopleAuthorizationStrategy; // ------------------------------------------------------- // NOTE: This is an exploratory style of unit testing. // ------------------------------------------------------- public static class FeatureExtensions { - public static IRelationshipsAuthorizationContextDataProvider that_returns_property_names( - this IRelationshipsAuthorizationContextDataProvider dependency, + public static IRelationshipsAuthorizationContextDataProvider that_returns_property_names( + this IRelationshipsAuthorizationContextDataProvider dependency, params string[] propertyNames) { A.CallTo(() => @@ -46,9 +46,9 @@ public static IRelationshipsAuthorizationContextDataProvider that_always_returns( - this IRelationshipsAuthorizationContextDataProviderFactory dependency, - IRelationshipsAuthorizationContextDataProvider provider) + public static IRelationshipsAuthorizationContextDataProviderFactory that_always_returns( + this IRelationshipsAuthorizationContextDataProviderFactory dependency, + IRelationshipsAuthorizationContextDataProvider provider) { A.CallTo(() => dependency.GetProvider(A.Ignored)) @@ -171,7 +171,7 @@ public void Should_NOT_throw_a_NotSupportedException() } public class When_authorizing_a_single_item_request_with_correct_claims_for_request - : ScenarioFor> + : ScenarioFor { [Schema("TestSchema")] private class TestEntity @@ -286,7 +286,7 @@ private static DomainModelBuilder CreateValidDomainModel() } public class When_authorizing_a_single_item_request_with_all_claim_values_needed_for_local_request_authorization - : ScenarioFor> + : ScenarioFor { private class TestEntity { diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index f77e3040c7..2343503bf4 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -19,23 +19,22 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.Sample /// Creates and returns an instance for making authorization decisions for access to the sample.BusRoute table of the BusRoute aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class BusRouteRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class BusRouteRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IBusRoute resource) + public RelationshipsAuthorizationContextData GetContextData(IBusRoute resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'busRoute' resource for obtaining authorization context data cannot be null."); var entity = resource as BusRoute; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // StaffUSI = entity.StaffUSI, // Not part of primary key - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -55,7 +54,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((BusRoute) resource); } @@ -65,24 +64,23 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the sample.StudentArtProgramAssociation table of the StudentArtProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentArtProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentArtProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentArtProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentArtProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentArtProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentArtProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -103,7 +101,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentArtProgramAssociation) resource); } @@ -113,24 +111,23 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the sample.StudentGraduationPlanAssociation table of the StudentGraduationPlanAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentGraduationPlanAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentGraduationPlanAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentGraduationPlanAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentGraduationPlanAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentGraduationPlanAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentGraduationPlanAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // StaffUSI = entity.StaffUSI, // Not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -151,7 +148,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentGraduationPlanAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index 95aba1256b..17ce4deb7f 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -17,24 +17,23 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.SampleAlterna /// Creates and returns an instance for making authorization decisions for access to the samplealternativeeducationprogram.StudentAlternativeEducationProgramAssociation table of the StudentAlternativeEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAlternativeEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAlternativeEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAlternativeEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAlternativeEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAlternativeEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAlternativeEducationProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -55,7 +54,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAlternativeEducationProgramAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index 3fbf72f5ce..890b390282 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_4.0.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -28,22 +28,21 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.TPDM /// Creates and returns an instance for making authorization decisions for access to the tpdm.CandidateEducatorPreparationProgramAssociation table of the CandidateEducatorPreparationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CandidateEducatorPreparationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CandidateEducatorPreparationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICandidateEducatorPreparationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ICandidateEducatorPreparationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'candidateEducatorPreparationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as CandidateEducatorPreparationProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -62,7 +61,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CandidateEducatorPreparationProgramAssociation) resource); } @@ -72,22 +71,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EducatorPreparationProgram table of the EducatorPreparationProgram aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducatorPreparationProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducatorPreparationProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducatorPreparationProgram resource) + public RelationshipsAuthorizationContextData GetContextData(IEducatorPreparationProgram resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educatorPreparationProgram' resource for obtaining authorization context data cannot be null."); var entity = resource as EducatorPreparationProgram; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -106,7 +104,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducatorPreparationProgram) resource); } @@ -116,22 +114,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.Evaluation table of the Evaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as Evaluation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -150,7 +147,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Evaluation) resource); } @@ -160,22 +157,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationElement table of the EvaluationElement aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationElement resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationElement resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationElement' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationElement; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -194,7 +190,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationElement) resource); } @@ -204,22 +200,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationElementRating table of the EvaluationElementRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationElementRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationElementRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationElementRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationElementRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationElementRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationElementRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -238,7 +233,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationElementRating) resource); } @@ -248,22 +243,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationObjective table of the EvaluationObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationObjective; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -282,7 +276,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationObjective) resource); } @@ -292,22 +286,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationObjectiveRating table of the EvaluationObjectiveRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationObjectiveRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationObjectiveRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationObjectiveRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationObjectiveRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationObjectiveRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationObjectiveRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -326,7 +319,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationObjectiveRating) resource); } @@ -336,23 +329,22 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationRating table of the EvaluationRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // SchoolId = entity.SchoolId, // Not part of primary key - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -372,7 +364,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationRating) resource); } @@ -382,22 +374,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.FinancialAid table of the FinancialAid aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class FinancialAidRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class FinancialAidRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IFinancialAid resource) + public RelationshipsAuthorizationContextData GetContextData(IFinancialAid resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'financialAid' resource for obtaining authorization context data cannot be null."); var entity = resource as FinancialAid; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -416,7 +407,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((FinancialAid) resource); } @@ -426,22 +417,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.PerformanceEvaluation table of the PerformanceEvaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PerformanceEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PerformanceEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPerformanceEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IPerformanceEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'performanceEvaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as PerformanceEvaluation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -460,7 +450,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PerformanceEvaluation) resource); } @@ -470,22 +460,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.PerformanceEvaluationRating table of the PerformanceEvaluationRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PerformanceEvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PerformanceEvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPerformanceEvaluationRating resource) + public RelationshipsAuthorizationContextData GetContextData(IPerformanceEvaluationRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'performanceEvaluationRating' resource for obtaining authorization context data cannot be null."); var entity = resource as PerformanceEvaluationRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -504,7 +493,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PerformanceEvaluationRating) resource); } @@ -514,22 +503,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.RubricDimension table of the RubricDimension aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class RubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class RubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IRubricDimension resource) + public RelationshipsAuthorizationContextData GetContextData(IRubricDimension resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'rubricDimension' resource for obtaining authorization context data cannot be null."); var entity = resource as RubricDimension; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -548,7 +536,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((RubricDimension) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Standard_Std_4.0.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Standard_Std_4.0.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index d7aece7798..0ce24d64c4 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Standard_Std_4.0.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/4.0.0/DataStandard_400_ApprovalTests.Verify.Standard_Std_4.0.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -120,20 +120,19 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.EdFi /// Creates and returns an instance for making authorization decisions for access to the edfi.AcademicWeek table of the AcademicWeek aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AcademicWeekRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AcademicWeekRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAcademicWeek resource) + public RelationshipsAuthorizationContextData GetContextData(IAcademicWeek resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'academicWeek' resource for obtaining authorization context data cannot be null."); var entity = resource as AcademicWeek; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -154,7 +153,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((AcademicWeek) resource); } @@ -164,20 +163,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.AccountabilityRating table of the AccountabilityRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AccountabilityRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AccountabilityRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAccountabilityRating resource) + public RelationshipsAuthorizationContextData GetContextData(IAccountabilityRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'accountabilityRating' resource for obtaining authorization context data cannot be null."); var entity = resource as AccountabilityRating; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -198,7 +196,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((AccountabilityRating) resource); } @@ -208,20 +206,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Assessment table of the Assessment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAssessment resource) + public RelationshipsAuthorizationContextData GetContextData(IAssessment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'assessment' resource for obtaining authorization context data cannot be null."); var entity = resource as Assessment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key return contextData; } @@ -242,7 +239,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Assessment) resource); } @@ -252,20 +249,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.BellSchedule table of the BellSchedule aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class BellScheduleRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class BellScheduleRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IBellSchedule resource) + public RelationshipsAuthorizationContextData GetContextData(IBellSchedule resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'bellSchedule' resource for obtaining authorization context data cannot be null."); var entity = resource as BellSchedule; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -286,7 +282,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((BellSchedule) resource); } @@ -296,20 +292,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Calendar table of the Calendar aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CalendarRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CalendarRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICalendar resource) + public RelationshipsAuthorizationContextData GetContextData(ICalendar resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'calendar' resource for obtaining authorization context data cannot be null."); var entity = resource as Calendar; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -330,7 +325,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Calendar) resource); } @@ -340,20 +335,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CalendarDate table of the CalendarDate aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CalendarDateRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CalendarDateRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICalendarDate resource) + public RelationshipsAuthorizationContextData GetContextData(ICalendarDate resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'calendarDate' resource for obtaining authorization context data cannot be null."); var entity = resource as CalendarDate; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -374,7 +368,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CalendarDate) resource); } @@ -384,20 +378,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ChartOfAccount table of the ChartOfAccount aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ChartOfAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ChartOfAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IChartOfAccount resource) + public RelationshipsAuthorizationContextData GetContextData(IChartOfAccount resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'chartOfAccount' resource for obtaining authorization context data cannot be null."); var entity = resource as ChartOfAccount; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -418,7 +411,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ChartOfAccount) resource); } @@ -428,20 +421,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ClassPeriod table of the ClassPeriod aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ClassPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ClassPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IClassPeriod resource) + public RelationshipsAuthorizationContextData GetContextData(IClassPeriod resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'classPeriod' resource for obtaining authorization context data cannot be null."); var entity = resource as ClassPeriod; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -462,7 +454,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ClassPeriod) resource); } @@ -472,20 +464,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Cohort table of the Cohort aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CohortRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CohortRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICohort resource) + public RelationshipsAuthorizationContextData GetContextData(ICohort resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'cohort' resource for obtaining authorization context data cannot be null."); var entity = resource as Cohort; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -506,7 +497,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Cohort) resource); } @@ -516,20 +507,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityOrganization table of the CommunityOrganization aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityOrganization resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityOrganization resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityOrganization' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityOrganization; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.CommunityOrganizationId = entity.CommunityOrganizationId == default(int) ? null as int? : entity.CommunityOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -550,7 +540,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityOrganization) resource); } @@ -560,20 +550,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityProvider table of the CommunityProvider aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityProviderRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityProviderRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityProvider resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityProvider resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityProvider' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityProvider; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CommunityOrganizationId = entity.CommunityOrganizationId, // Not part of primary key contextData.CommunityProviderId = entity.CommunityProviderId == default(int) ? null as int? : entity.CommunityProviderId; // Primary key property, Only Education Organization Id present return contextData; @@ -596,7 +585,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityProvider) resource); } @@ -606,20 +595,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityProviderLicense table of the CommunityProviderLicense aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityProviderLicenseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityProviderLicenseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityProviderLicense resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityProviderLicense resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityProviderLicense' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityProviderLicense; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.CommunityProviderId = entity.CommunityProviderId == default(int) ? null as int? : entity.CommunityProviderId; // Primary key property, Only Education Organization Id present return contextData; } @@ -640,7 +628,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityProviderLicense) resource); } @@ -650,20 +638,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CompetencyObjective table of the CompetencyObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICompetencyObjective resource) + public RelationshipsAuthorizationContextData GetContextData(ICompetencyObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'competencyObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as CompetencyObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -684,7 +671,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CompetencyObjective) resource); } @@ -694,20 +681,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Course table of the Course aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourse resource) + public RelationshipsAuthorizationContextData GetContextData(ICourse resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'course' resource for obtaining authorization context data cannot be null."); var entity = resource as Course; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -728,7 +714,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Course) resource); } @@ -738,20 +724,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CourseOffering table of the CourseOffering aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseOfferingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseOfferingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourseOffering resource) + public RelationshipsAuthorizationContextData GetContextData(ICourseOffering resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'courseOffering' resource for obtaining authorization context data cannot be null."); var entity = resource as CourseOffering; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -774,7 +759,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CourseOffering) resource); } @@ -784,20 +769,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CourseTranscript table of the CourseTranscript aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseTranscriptRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseTranscriptRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourseTranscript resource) + public RelationshipsAuthorizationContextData GetContextData(ICourseTranscript resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'courseTranscript' resource for obtaining authorization context data cannot be null."); var entity = resource as CourseTranscript; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CourseEducationOrganizationId = entity.CourseEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ExternalEducationOrganizationId = entity.ExternalEducationOrganizationId, // Role name applied and not part of primary key @@ -824,7 +808,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CourseTranscript) resource); } @@ -834,20 +818,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.DisciplineAction table of the DisciplineAction aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IDisciplineAction resource) + public RelationshipsAuthorizationContextData GetContextData(IDisciplineAction resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'disciplineAction' resource for obtaining authorization context data cannot be null."); var entity = resource as DisciplineAction; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // AssignmentSchoolId = entity.AssignmentSchoolId, // Role name applied and not part of primary key // ResponsibilitySchoolId = entity.ResponsibilitySchoolId, // Role name applied and not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -872,7 +855,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((DisciplineAction) resource); } @@ -882,20 +865,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.DisciplineIncident table of the DisciplineIncident aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class DisciplineIncidentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class DisciplineIncidentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IDisciplineIncident resource) + public RelationshipsAuthorizationContextData GetContextData(IDisciplineIncident resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'disciplineIncident' resource for obtaining authorization context data cannot be null."); var entity = resource as DisciplineIncident; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present // StaffUSI = entity.StaffUSI, // Not part of primary key return contextData; @@ -918,7 +900,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((DisciplineIncident) resource); } @@ -928,20 +910,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganization table of the EducationOrganization aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganization resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganization resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganization' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganization; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -962,7 +943,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganization) resource); } @@ -972,20 +953,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationInterventionPrescriptionAssociation table of the EducationOrganizationInterventionPrescriptionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationInterventionPrescriptionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationInterventionPrescriptionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationInterventionPrescriptionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationInterventionPrescriptionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationInterventionPrescriptionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationInterventionPrescriptionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // InterventionPrescriptionEducationOrganizationId = entity.InterventionPrescriptionEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1008,7 +988,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationInterventionPrescriptionAssociation) resource); } @@ -1018,20 +998,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationNetwork table of the EducationOrganizationNetwork aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationNetworkRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationNetworkRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationNetwork resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationNetwork resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationNetwork' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationNetwork; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationNetworkId = entity.EducationOrganizationNetworkId == default(int) ? null as int? : entity.EducationOrganizationNetworkId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1052,7 +1031,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationNetwork) resource); } @@ -1062,20 +1041,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationNetworkAssociation table of the EducationOrganizationNetworkAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationNetworkAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationNetworkAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationNetworkAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationNetworkAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationNetworkAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationNetworkAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationNetworkId = entity.EducationOrganizationNetworkId == default(int) ? null as int? : entity.EducationOrganizationNetworkId; // Primary key property, Only Education Organization Id present // MemberEducationOrganizationId = entity.MemberEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1098,7 +1076,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationNetworkAssociation) resource); } @@ -1108,20 +1086,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationPeerAssociation table of the EducationOrganizationPeerAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationPeerAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationPeerAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationPeerAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationPeerAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationPeerAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationPeerAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // PeerEducationOrganizationId = entity.PeerEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1144,7 +1121,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationPeerAssociation) resource); } @@ -1154,20 +1131,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationServiceCenter table of the EducationServiceCenter aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationServiceCenterRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationServiceCenterRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationServiceCenter resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationServiceCenter resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationServiceCenter' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationServiceCenter; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationServiceCenterId = entity.EducationServiceCenterId == default(int) ? null as int? : entity.EducationServiceCenterId; // Primary key property, Only Education Organization Id present // StateEducationAgencyId = entity.StateEducationAgencyId, // Not part of primary key return contextData; @@ -1190,7 +1166,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationServiceCenter) resource); } @@ -1200,20 +1176,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.FeederSchoolAssociation table of the FeederSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class FeederSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class FeederSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IFeederSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IFeederSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'feederSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as FeederSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // FeederSchoolId = entity.FeederSchoolId, // Primary key property, Role name applied contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -1236,7 +1211,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((FeederSchoolAssociation) resource); } @@ -1246,20 +1221,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GeneralStudentProgramAssociation table of the GeneralStudentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GeneralStudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GeneralStudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGeneralStudentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IGeneralStudentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'generalStudentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as GeneralStudentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -1284,7 +1258,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GeneralStudentProgramAssociation) resource); } @@ -1294,20 +1268,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Grade table of the Grade aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradeRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradeRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGrade resource) + public RelationshipsAuthorizationContextData GetContextData(IGrade resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'grade' resource for obtaining authorization context data cannot be null."); var entity = resource as Grade; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -1330,7 +1303,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Grade) resource); } @@ -1340,20 +1313,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GradebookEntry table of the GradebookEntry aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGradebookEntry resource) + public RelationshipsAuthorizationContextData GetContextData(IGradebookEntry resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'gradebookEntry' resource for obtaining authorization context data cannot be null."); var entity = resource as GradebookEntry; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // SchoolId = entity.SchoolId, // Not part of primary key return contextData; } @@ -1374,7 +1346,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GradebookEntry) resource); } @@ -1384,20 +1356,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GradingPeriod table of the GradingPeriod aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradingPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradingPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGradingPeriod resource) + public RelationshipsAuthorizationContextData GetContextData(IGradingPeriod resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'gradingPeriod' resource for obtaining authorization context data cannot be null."); var entity = resource as GradingPeriod; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1418,7 +1389,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GradingPeriod) resource); } @@ -1428,20 +1399,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GraduationPlan table of the GraduationPlan aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GraduationPlanRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GraduationPlanRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGraduationPlan resource) + public RelationshipsAuthorizationContextData GetContextData(IGraduationPlan resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'graduationPlan' resource for obtaining authorization context data cannot be null."); var entity = resource as GraduationPlan; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1462,7 +1432,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GraduationPlan) resource); } @@ -1472,20 +1442,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Intervention table of the Intervention aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IIntervention resource) + public RelationshipsAuthorizationContextData GetContextData(IIntervention resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'intervention' resource for obtaining authorization context data cannot be null."); var entity = resource as Intervention; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1506,7 +1475,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Intervention) resource); } @@ -1516,20 +1485,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.InterventionPrescription table of the InterventionPrescription aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionPrescriptionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionPrescriptionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IInterventionPrescription resource) + public RelationshipsAuthorizationContextData GetContextData(IInterventionPrescription resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'interventionPrescription' resource for obtaining authorization context data cannot be null."); var entity = resource as InterventionPrescription; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1550,7 +1518,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((InterventionPrescription) resource); } @@ -1560,20 +1528,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.InterventionStudy table of the InterventionStudy aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionStudyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionStudyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IInterventionStudy resource) + public RelationshipsAuthorizationContextData GetContextData(IInterventionStudy resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'interventionStudy' resource for obtaining authorization context data cannot be null."); var entity = resource as InterventionStudy; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // InterventionPrescriptionEducationOrganizationId = entity.InterventionPrescriptionEducationOrganizationId, // Role name applied and not part of primary key return contextData; @@ -1596,7 +1563,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((InterventionStudy) resource); } @@ -1606,20 +1573,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalAccount table of the LocalAccount aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalAccount resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalAccount resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localAccount' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalAccount; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ChartOfAccountEducationOrganizationId = entity.ChartOfAccountEducationOrganizationId, // Role name applied and not part of primary key contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; @@ -1642,7 +1608,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalAccount) resource); } @@ -1652,20 +1618,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalActual table of the LocalActual aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalActualRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalActualRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalActual resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalActual resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localActual' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalActual; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1686,7 +1651,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalActual) resource); } @@ -1696,20 +1661,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalBudget table of the LocalBudget aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalBudgetRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalBudgetRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalBudget resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalBudget resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localBudget' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalBudget; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1730,7 +1694,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalBudget) resource); } @@ -1740,20 +1704,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalContractedStaff table of the LocalContractedStaff aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalContractedStaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalContractedStaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalContractedStaff resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalContractedStaff resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localContractedStaff' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalContractedStaff; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -1776,7 +1739,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalContractedStaff) resource); } @@ -1786,20 +1749,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalEducationAgency table of the LocalEducationAgency aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalEducationAgency resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalEducationAgency resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localEducationAgency' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalEducationAgency; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationServiceCenterId = entity.EducationServiceCenterId, // Not part of primary key contextData.LocalEducationAgencyId = entity.LocalEducationAgencyId == default(int) ? null as int? : entity.LocalEducationAgencyId; // Primary key property, Only Education Organization Id present // ParentLocalEducationAgencyId = entity.ParentLocalEducationAgencyId, // Role name applied and not part of primary key @@ -1826,7 +1788,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalEducationAgency) resource); } @@ -1836,20 +1798,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalEncumbrance table of the LocalEncumbrance aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalEncumbranceRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalEncumbranceRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalEncumbrance resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalEncumbrance resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localEncumbrance' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalEncumbrance; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1870,7 +1831,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalEncumbrance) resource); } @@ -1880,20 +1841,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalPayroll table of the LocalPayroll aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalPayrollRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalPayrollRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalPayroll resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalPayroll resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localPayroll' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalPayroll; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -1916,7 +1876,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalPayroll) resource); } @@ -1926,20 +1886,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Location table of the Location aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocation resource) + public RelationshipsAuthorizationContextData GetContextData(ILocation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'location' resource for obtaining authorization context data cannot be null."); var entity = resource as Location; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1960,7 +1919,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Location) resource); } @@ -1970,20 +1929,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.OpenStaffPosition table of the OpenStaffPosition aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class OpenStaffPositionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class OpenStaffPositionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IOpenStaffPosition resource) + public RelationshipsAuthorizationContextData GetContextData(IOpenStaffPosition resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'openStaffPosition' resource for obtaining authorization context data cannot be null."); var entity = resource as OpenStaffPosition; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2004,7 +1962,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((OpenStaffPosition) resource); } @@ -2014,20 +1972,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.OrganizationDepartment table of the OrganizationDepartment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IOrganizationDepartment resource) + public RelationshipsAuthorizationContextData GetContextData(IOrganizationDepartment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'organizationDepartment' resource for obtaining authorization context data cannot be null."); var entity = resource as OrganizationDepartment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.OrganizationDepartmentId = entity.OrganizationDepartmentId == default(int) ? null as int? : entity.OrganizationDepartmentId; // Primary key property, Only Education Organization Id present // ParentEducationOrganizationId = entity.ParentEducationOrganizationId, // Role name applied and not part of primary key return contextData; @@ -2050,7 +2007,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((OrganizationDepartment) resource); } @@ -2060,20 +2017,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Parent table of the Parent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ParentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ParentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IParent resource) + public RelationshipsAuthorizationContextData GetContextData(IParent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'parent' resource for obtaining authorization context data cannot be null."); var entity = resource as Parent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.ParentUSI = entity.ParentUSI == default(int) ? null as int? : entity.ParentUSI; // Primary key property, USI return contextData; } @@ -2094,7 +2050,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Parent) resource); } @@ -2104,20 +2060,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.PostSecondaryEvent table of the PostSecondaryEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PostSecondaryEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PostSecondaryEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPostSecondaryEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IPostSecondaryEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'postSecondaryEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as PostSecondaryEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // PostSecondaryInstitutionId = entity.PostSecondaryInstitutionId, // Not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -2140,7 +2095,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PostSecondaryEvent) resource); } @@ -2150,20 +2105,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.PostSecondaryInstitution table of the PostSecondaryInstitution aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PostSecondaryInstitutionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PostSecondaryInstitutionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPostSecondaryInstitution resource) + public RelationshipsAuthorizationContextData GetContextData(IPostSecondaryInstitution resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'postSecondaryInstitution' resource for obtaining authorization context data cannot be null."); var entity = resource as PostSecondaryInstitution; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.PostSecondaryInstitutionId = entity.PostSecondaryInstitutionId == default(int) ? null as int? : entity.PostSecondaryInstitutionId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2184,7 +2138,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PostSecondaryInstitution) resource); } @@ -2194,20 +2148,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Program table of the Program aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgram resource) + public RelationshipsAuthorizationContextData GetContextData(IProgram resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'program' resource for obtaining authorization context data cannot be null."); var entity = resource as Program; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2228,7 +2181,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Program) resource); } @@ -2238,20 +2191,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ReportCard table of the ReportCard aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ReportCardRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ReportCardRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IReportCard resource) + public RelationshipsAuthorizationContextData GetContextData(IReportCard resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'reportCard' resource for obtaining authorization context data cannot be null."); var entity = resource as ReportCard; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // GradingPeriodSchoolId = entity.GradingPeriodSchoolId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -2276,7 +2228,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ReportCard) resource); } @@ -2286,20 +2238,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.RestraintEvent table of the RestraintEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class RestraintEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class RestraintEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IRestraintEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IRestraintEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'restraintEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as RestraintEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -2322,7 +2273,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((RestraintEvent) resource); } @@ -2332,20 +2283,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.School table of the School aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SchoolRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SchoolRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISchool resource) + public RelationshipsAuthorizationContextData GetContextData(ISchool resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'school' resource for obtaining authorization context data cannot be null."); var entity = resource as School; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // LocalEducationAgencyId = entity.LocalEducationAgencyId, // Not part of primary key contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -2368,7 +2318,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((School) resource); } @@ -2378,20 +2328,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Section table of the Section aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SectionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SectionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISection resource) + public RelationshipsAuthorizationContextData GetContextData(ISection resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'section' resource for obtaining authorization context data cannot be null."); var entity = resource as Section; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // LocationSchoolId = entity.LocationSchoolId, // Role name applied and not part of primary key contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -2414,7 +2363,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Section) resource); } @@ -2424,20 +2373,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SectionAttendanceTakenEvent table of the SectionAttendanceTakenEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SectionAttendanceTakenEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SectionAttendanceTakenEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISectionAttendanceTakenEvent resource) + public RelationshipsAuthorizationContextData GetContextData(ISectionAttendanceTakenEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'sectionAttendanceTakenEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as SectionAttendanceTakenEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present // StaffUSI = entity.StaffUSI, // Not part of primary key return contextData; @@ -2460,7 +2408,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SectionAttendanceTakenEvent) resource); } @@ -2470,20 +2418,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Session table of the Session aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SessionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SessionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISession resource) + public RelationshipsAuthorizationContextData GetContextData(ISession resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'session' resource for obtaining authorization context data cannot be null."); var entity = resource as Session; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2504,7 +2451,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Session) resource); } @@ -2514,20 +2461,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Staff table of the Staff aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaff resource) + public RelationshipsAuthorizationContextData GetContextData(IStaff resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staff' resource for obtaining authorization context data cannot be null."); var entity = resource as Staff; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -2548,7 +2494,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Staff) resource); } @@ -2558,20 +2504,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffAbsenceEvent table of the StaffAbsenceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffAbsenceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffAbsenceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffAbsenceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffAbsenceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffAbsenceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffAbsenceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -2592,7 +2537,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffAbsenceEvent) resource); } @@ -2602,20 +2547,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffCohortAssociation table of the StaffCohortAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffCohortAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffCohortAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffCohortAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffCohortAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2638,7 +2582,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffCohortAssociation) resource); } @@ -2648,20 +2592,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffDisciplineIncidentAssociation table of the StaffDisciplineIncidentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffDisciplineIncidentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffDisciplineIncidentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffDisciplineIncidentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffDisciplineIncidentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2684,7 +2627,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffDisciplineIncidentAssociation) resource); } @@ -2694,20 +2637,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationAssignmentAssociation table of the StaffEducationOrganizationAssignmentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationAssignmentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationAssignmentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationAssignmentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationAssignmentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationAssignmentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationAssignmentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // EmploymentEducationOrganizationId = entity.EmploymentEducationOrganizationId, // Role name applied and not part of primary key contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI @@ -2732,7 +2674,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationAssignmentAssociation) resource); } @@ -2742,20 +2684,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationContactAssociation table of the StaffEducationOrganizationContactAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationContactAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationContactAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationContactAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationContactAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2778,7 +2719,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationContactAssociation) resource); } @@ -2788,20 +2729,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationEmploymentAssociation table of the StaffEducationOrganizationEmploymentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationEmploymentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationEmploymentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationEmploymentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationEmploymentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationEmploymentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationEmploymentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2824,7 +2764,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationEmploymentAssociation) resource); } @@ -2834,20 +2774,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffLeave table of the StaffLeave aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffLeaveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffLeaveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffLeave resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffLeave resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffLeave' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffLeave; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -2868,7 +2807,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffLeave) resource); } @@ -2878,20 +2817,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffProgramAssociation table of the StaffProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2914,7 +2852,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffProgramAssociation) resource); } @@ -2924,20 +2862,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffSchoolAssociation table of the StaffSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2960,7 +2897,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffSchoolAssociation) resource); } @@ -2970,20 +2907,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffSectionAssociation table of the StaffSectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffSectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffSectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffSectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffSectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -3006,7 +2942,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffSectionAssociation) resource); } @@ -3016,20 +2952,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StateEducationAgency table of the StateEducationAgency aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StateEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StateEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStateEducationAgency resource) + public RelationshipsAuthorizationContextData GetContextData(IStateEducationAgency resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'stateEducationAgency' resource for obtaining authorization context data cannot be null."); var entity = resource as StateEducationAgency; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StateEducationAgencyId = entity.StateEducationAgencyId == default(int) ? null as int? : entity.StateEducationAgencyId; // Primary key property, Only Education Organization Id present return contextData; } @@ -3050,7 +2985,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StateEducationAgency) resource); } @@ -3060,20 +2995,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Student table of the Student aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'student' resource for obtaining authorization context data cannot be null."); var entity = resource as Student; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; } @@ -3094,7 +3028,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Student) resource); } @@ -3104,20 +3038,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAcademicRecord table of the StudentAcademicRecord aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAcademicRecordRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAcademicRecordRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAcademicRecord resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAcademicRecord resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAcademicRecord' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAcademicRecord; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3140,7 +3073,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAcademicRecord) resource); } @@ -3150,20 +3083,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAssessment table of the StudentAssessment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAssessment resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAssessment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAssessment' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAssessment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ReportedSchoolId = entity.ReportedSchoolId, // Role name applied and not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3186,7 +3118,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAssessment) resource); } @@ -3196,20 +3128,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAssessmentEducationOrganizationAssociation table of the StudentAssessmentEducationOrganizationAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAssessmentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAssessmentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAssessmentEducationOrganizationAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAssessmentEducationOrganizationAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAssessmentEducationOrganizationAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAssessmentEducationOrganizationAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3232,7 +3163,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAssessmentEducationOrganizationAssociation) resource); } @@ -3242,20 +3173,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCohortAssociation table of the StudentCohortAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCohortAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCohortAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCohortAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCohortAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3278,7 +3208,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCohortAssociation) resource); } @@ -3288,20 +3218,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCompetencyObjective table of the StudentCompetencyObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCompetencyObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCompetencyObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCompetencyObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCompetencyObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // GradingPeriodSchoolId = entity.GradingPeriodSchoolId, // Primary key property, Role name applied // ObjectiveEducationOrganizationId = entity.ObjectiveEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3326,7 +3255,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCompetencyObjective) resource); } @@ -3336,20 +3265,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCTEProgramAssociation table of the StudentCTEProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCTEProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCTEProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCTEProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCTEProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCTEProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCTEProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3374,7 +3302,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCTEProgramAssociation) resource); } @@ -3384,20 +3312,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentDisciplineIncidentAssociation table of the StudentDisciplineIncidentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentDisciplineIncidentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentDisciplineIncidentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentDisciplineIncidentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentDisciplineIncidentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3420,7 +3347,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentDisciplineIncidentAssociation) resource); } @@ -3430,20 +3357,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentDisciplineIncidentBehaviorAssociation table of the StudentDisciplineIncidentBehaviorAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentDisciplineIncidentBehaviorAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentDisciplineIncidentBehaviorAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentDisciplineIncidentBehaviorAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentDisciplineIncidentBehaviorAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentDisciplineIncidentBehaviorAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentDisciplineIncidentBehaviorAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3466,7 +3392,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentDisciplineIncidentBehaviorAssociation) resource); } @@ -3476,20 +3402,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentDisciplineIncidentNonOffenderAssociation table of the StudentDisciplineIncidentNonOffenderAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentDisciplineIncidentNonOffenderAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentDisciplineIncidentNonOffenderAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentDisciplineIncidentNonOffenderAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentDisciplineIncidentNonOffenderAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentDisciplineIncidentNonOffenderAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentDisciplineIncidentNonOffenderAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3512,7 +3437,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentDisciplineIncidentNonOffenderAssociation) resource); } @@ -3522,20 +3447,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentEducationOrganizationAssociation table of the StudentEducationOrganizationAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentEducationOrganizationAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentEducationOrganizationAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentEducationOrganizationAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentEducationOrganizationAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3558,7 +3482,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentEducationOrganizationAssociation) resource); } @@ -3568,20 +3492,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentEducationOrganizationResponsibilityAssociation table of the StudentEducationOrganizationResponsibilityAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentEducationOrganizationResponsibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentEducationOrganizationResponsibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentEducationOrganizationResponsibilityAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentEducationOrganizationResponsibilityAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentEducationOrganizationResponsibilityAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentEducationOrganizationResponsibilityAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3604,7 +3527,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentEducationOrganizationResponsibilityAssociation) resource); } @@ -3614,20 +3537,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentGradebookEntry table of the StudentGradebookEntry aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentGradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentGradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentGradebookEntry resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentGradebookEntry resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentGradebookEntry' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentGradebookEntry; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; } @@ -3648,7 +3570,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentGradebookEntry) resource); } @@ -3658,20 +3580,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentHomelessProgramAssociation table of the StudentHomelessProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentHomelessProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentHomelessProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentHomelessProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentHomelessProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentHomelessProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentHomelessProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3696,7 +3617,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentHomelessProgramAssociation) resource); } @@ -3706,20 +3627,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentInterventionAssociation table of the StudentInterventionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentInterventionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentInterventionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentInterventionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentInterventionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentInterventionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentInterventionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CohortEducationOrganizationId = entity.CohortEducationOrganizationId, // Role name applied and not part of primary key contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3744,7 +3664,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentInterventionAssociation) resource); } @@ -3754,20 +3674,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentInterventionAttendanceEvent table of the StudentInterventionAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentInterventionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentInterventionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentInterventionAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentInterventionAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentInterventionAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentInterventionAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3790,7 +3709,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentInterventionAttendanceEvent) resource); } @@ -3800,20 +3719,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentLanguageInstructionProgramAssociation table of the StudentLanguageInstructionProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentLanguageInstructionProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentLanguageInstructionProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentLanguageInstructionProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentLanguageInstructionProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentLanguageInstructionProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentLanguageInstructionProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3838,7 +3756,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentLanguageInstructionProgramAssociation) resource); } @@ -3848,20 +3766,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentLearningObjective table of the StudentLearningObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentLearningObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentLearningObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentLearningObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentLearningObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentLearningObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentLearningObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // GradingPeriodSchoolId = entity.GradingPeriodSchoolId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3884,7 +3801,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentLearningObjective) resource); } @@ -3894,20 +3811,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentMigrantEducationProgramAssociation table of the StudentMigrantEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentMigrantEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentMigrantEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentMigrantEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentMigrantEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentMigrantEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentMigrantEducationProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3932,7 +3848,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentMigrantEducationProgramAssociation) resource); } @@ -3942,20 +3858,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentNeglectedOrDelinquentProgramAssociation table of the StudentNeglectedOrDelinquentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentNeglectedOrDelinquentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentNeglectedOrDelinquentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentNeglectedOrDelinquentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentNeglectedOrDelinquentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentNeglectedOrDelinquentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentNeglectedOrDelinquentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3980,7 +3895,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentNeglectedOrDelinquentProgramAssociation) resource); } @@ -3990,20 +3905,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentParentAssociation table of the StudentParentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentParentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentParentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentParentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentParentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentParentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentParentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.ParentUSI = entity.ParentUSI == default(int) ? null as int? : entity.ParentUSI; // Primary key property, USI contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4026,7 +3940,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentParentAssociation) resource); } @@ -4036,20 +3950,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentProgramAssociation table of the StudentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4074,7 +3987,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentProgramAssociation) resource); } @@ -4084,20 +3997,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentProgramAttendanceEvent table of the StudentProgramAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentProgramAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentProgramAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentProgramAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentProgramAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentProgramAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentProgramAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4122,7 +4034,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentProgramAttendanceEvent) resource); } @@ -4132,20 +4044,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolAssociation table of the StudentSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4170,7 +4081,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolAssociation) resource); } @@ -4180,20 +4091,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolAttendanceEvent table of the StudentSchoolAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4216,7 +4126,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolAttendanceEvent) resource); } @@ -4226,20 +4136,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolFoodServiceProgramAssociation table of the StudentSchoolFoodServiceProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolFoodServiceProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolFoodServiceProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolFoodServiceProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolFoodServiceProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolFoodServiceProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolFoodServiceProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4264,7 +4173,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolFoodServiceProgramAssociation) resource); } @@ -4274,20 +4183,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSectionAssociation table of the StudentSectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4310,7 +4218,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSectionAssociation) resource); } @@ -4320,20 +4228,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSectionAttendanceEvent table of the StudentSectionAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSectionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSectionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSectionAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSectionAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSectionAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSectionAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4356,7 +4263,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSectionAttendanceEvent) resource); } @@ -4366,20 +4273,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSpecialEducationProgramAssociation table of the StudentSpecialEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSpecialEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSpecialEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSpecialEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSpecialEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSpecialEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSpecialEducationProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4404,7 +4310,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSpecialEducationProgramAssociation) resource); } @@ -4414,20 +4320,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentTitleIPartAProgramAssociation table of the StudentTitleIPartAProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentTitleIPartAProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentTitleIPartAProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentTitleIPartAProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentTitleIPartAProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentTitleIPartAProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentTitleIPartAProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4452,7 +4357,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentTitleIPartAProgramAssociation) resource); } @@ -4462,20 +4367,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Survey table of the Survey aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurvey resource) + public RelationshipsAuthorizationContextData GetContextData(ISurvey resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'survey' resource for obtaining authorization context data cannot be null."); var entity = resource as Survey; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // SchoolId = entity.SchoolId, // Not part of primary key return contextData; @@ -4498,7 +4402,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Survey) resource); } @@ -4508,20 +4412,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyCourseAssociation table of the SurveyCourseAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyCourseAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyCourseAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyCourseAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyCourseAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyCourseAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyCourseAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4542,7 +4445,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyCourseAssociation) resource); } @@ -4552,20 +4455,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyProgramAssociation table of the SurveyProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4586,7 +4488,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyProgramAssociation) resource); } @@ -4596,20 +4498,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponse table of the SurveyResponse aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponse resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponse resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponse' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponse; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ParentUSI = entity.ParentUSI, // Not part of primary key // StaffUSI = entity.StaffUSI, // Not part of primary key // StudentUSI = entity.StudentUSI, // Not part of primary key @@ -4634,7 +4535,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponse) resource); } @@ -4644,20 +4545,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponseEducationOrganizationTargetAssociation table of the SurveyResponseEducationOrganizationTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponseEducationOrganizationTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponseEducationOrganizationTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponseEducationOrganizationTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponseEducationOrganizationTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4678,7 +4578,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponseEducationOrganizationTargetAssociation) resource); } @@ -4688,20 +4588,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponseStaffTargetAssociation table of the SurveyResponseStaffTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponseStaffTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponseStaffTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponseStaffTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponseStaffTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -4722,7 +4621,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponseStaffTargetAssociation) resource); } @@ -4732,20 +4631,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionAssociation table of the SurveySectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(int) ? null as int? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4766,7 +4664,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionAssociation) resource); } @@ -4776,20 +4674,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionResponseEducationOrganizationTargetAssociation table of the SurveySectionResponseEducationOrganizationTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionResponseEducationOrganizationTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionResponseEducationOrganizationTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionResponseEducationOrganizationTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionResponseEducationOrganizationTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(int) ? null as int? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4810,7 +4707,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionResponseEducationOrganizationTargetAssociation) resource); } @@ -4820,20 +4717,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionResponseStaffTargetAssociation table of the SurveySectionResponseStaffTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionResponseStaffTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionResponseStaffTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionResponseStaffTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionResponseStaffTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -4854,7 +4750,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionResponseStaffTargetAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index 3ea27f68c2..eccd9ae6e1 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.Sample.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -19,23 +19,22 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.Sample /// Creates and returns an instance for making authorization decisions for access to the sample.BusRoute table of the BusRoute aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class BusRouteRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class BusRouteRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IBusRoute resource) + public RelationshipsAuthorizationContextData GetContextData(IBusRoute resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'busRoute' resource for obtaining authorization context data cannot be null."); var entity = resource as BusRoute; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // StaffUSI = entity.StaffUSI, // Not part of primary key - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -55,7 +54,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((BusRoute) resource); } @@ -65,24 +64,23 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the sample.StudentArtProgramAssociation table of the StudentArtProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentArtProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentArtProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentArtProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentArtProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentArtProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentArtProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -103,7 +101,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentArtProgramAssociation) resource); } @@ -113,24 +111,23 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the sample.StudentGraduationPlanAssociation table of the StudentGraduationPlanAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentGraduationPlanAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentGraduationPlanAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentGraduationPlanAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentGraduationPlanAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentGraduationPlanAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentGraduationPlanAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // StaffUSI = entity.StaffUSI, // Not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -151,7 +148,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentGraduationPlanAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index 5ea34a1966..4daefaf501 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.SampleAlternativeEducationProgram.1.0.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -17,24 +17,23 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.SampleAlterna /// Creates and returns an instance for making authorization decisions for access to the samplealternativeeducationprogram.StudentAlternativeEducationProgramAssociation table of the StudentAlternativeEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAlternativeEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAlternativeEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAlternativeEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAlternativeEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAlternativeEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAlternativeEducationProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -55,7 +54,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAlternativeEducationProgramAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index c5b3924edb..5d1ceb452a 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Extensions.TPDM.1.1.0_Std_5.1.0_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -28,22 +28,21 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.TPDM /// Creates and returns an instance for making authorization decisions for access to the tpdm.CandidateEducatorPreparationProgramAssociation table of the CandidateEducatorPreparationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CandidateEducatorPreparationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CandidateEducatorPreparationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICandidateEducatorPreparationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ICandidateEducatorPreparationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'candidateEducatorPreparationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as CandidateEducatorPreparationProgramAssociation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -62,7 +61,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CandidateEducatorPreparationProgramAssociation) resource); } @@ -72,22 +71,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EducatorPreparationProgram table of the EducatorPreparationProgram aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducatorPreparationProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducatorPreparationProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducatorPreparationProgram resource) + public RelationshipsAuthorizationContextData GetContextData(IEducatorPreparationProgram resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educatorPreparationProgram' resource for obtaining authorization context data cannot be null."); var entity = resource as EducatorPreparationProgram; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -106,7 +104,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducatorPreparationProgram) resource); } @@ -116,22 +114,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.Evaluation table of the Evaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as Evaluation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -150,7 +147,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Evaluation) resource); } @@ -160,22 +157,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationElement table of the EvaluationElement aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationElement resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationElement resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationElement' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationElement; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -194,7 +190,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationElement) resource); } @@ -204,22 +200,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationElementRating table of the EvaluationElementRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationElementRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationElementRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationElementRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationElementRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationElementRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationElementRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -238,7 +233,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationElementRating) resource); } @@ -248,22 +243,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationObjective table of the EvaluationObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationObjective; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -282,7 +276,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationObjective) resource); } @@ -292,22 +286,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationObjectiveRating table of the EvaluationObjectiveRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationObjectiveRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationObjectiveRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationObjectiveRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationObjectiveRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationObjectiveRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationObjectiveRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -326,7 +319,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationObjectiveRating) resource); } @@ -336,23 +329,22 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.EvaluationRating table of the EvaluationRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationRating resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationRating' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // SchoolId = entity.SchoolId, // Not part of primary key - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -372,7 +364,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationRating) resource); } @@ -382,22 +374,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.FinancialAid table of the FinancialAid aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class FinancialAidRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class FinancialAidRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IFinancialAid resource) + public RelationshipsAuthorizationContextData GetContextData(IFinancialAid resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'financialAid' resource for obtaining authorization context data cannot be null."); var entity = resource as FinancialAid; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -416,7 +407,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((FinancialAid) resource); } @@ -426,22 +417,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.PerformanceEvaluation table of the PerformanceEvaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PerformanceEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PerformanceEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPerformanceEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IPerformanceEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'performanceEvaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as PerformanceEvaluation; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -460,7 +450,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PerformanceEvaluation) resource); } @@ -470,22 +460,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.PerformanceEvaluationRating table of the PerformanceEvaluationRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PerformanceEvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PerformanceEvaluationRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPerformanceEvaluationRating resource) + public RelationshipsAuthorizationContextData GetContextData(IPerformanceEvaluationRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'performanceEvaluationRating' resource for obtaining authorization context data cannot be null."); var entity = resource as PerformanceEvaluationRating; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -504,7 +493,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PerformanceEvaluationRating) resource); } @@ -514,22 +503,21 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the tpdm.RubricDimension table of the RubricDimension aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class RubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class RubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IRubricDimension resource) + public RelationshipsAuthorizationContextData GetContextData(IRubricDimension resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'rubricDimension' resource for obtaining authorization context data cannot be null."); var entity = resource as RubricDimension; - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; } /// @@ -548,7 +536,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((RubricDimension) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Standard_Std_5.1.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Standard_Std_5.1.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs index 56fa5ec3d2..a9c60c925a 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Standard_Std_5.1.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen.Tests/Approval/5.1.0/DataStandard_510_ApprovalTests.Verify.Standard_Std_5.1.0_Security_Authorization_EntityAuthorizationContextProviders.generated.approved.cs @@ -126,20 +126,19 @@ namespace EdFi.Ods.Api.Security.Authorization.ContextDataProviders.EdFi /// Creates and returns an instance for making authorization decisions for access to the edfi.AcademicWeek table of the AcademicWeek aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AcademicWeekRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AcademicWeekRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAcademicWeek resource) + public RelationshipsAuthorizationContextData GetContextData(IAcademicWeek resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'academicWeek' resource for obtaining authorization context data cannot be null."); var entity = resource as AcademicWeek; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -160,7 +159,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((AcademicWeek) resource); } @@ -170,20 +169,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.AccountabilityRating table of the AccountabilityRating aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AccountabilityRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AccountabilityRatingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAccountabilityRating resource) + public RelationshipsAuthorizationContextData GetContextData(IAccountabilityRating resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'accountabilityRating' resource for obtaining authorization context data cannot be null."); var entity = resource as AccountabilityRating; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -204,7 +202,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((AccountabilityRating) resource); } @@ -214,20 +212,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Assessment table of the Assessment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class AssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class AssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IAssessment resource) + public RelationshipsAuthorizationContextData GetContextData(IAssessment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'assessment' resource for obtaining authorization context data cannot be null."); var entity = resource as Assessment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key return contextData; } @@ -248,7 +245,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Assessment) resource); } @@ -258,20 +255,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.BellSchedule table of the BellSchedule aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class BellScheduleRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class BellScheduleRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IBellSchedule resource) + public RelationshipsAuthorizationContextData GetContextData(IBellSchedule resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'bellSchedule' resource for obtaining authorization context data cannot be null."); var entity = resource as BellSchedule; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -292,7 +288,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((BellSchedule) resource); } @@ -302,20 +298,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Calendar table of the Calendar aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CalendarRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CalendarRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICalendar resource) + public RelationshipsAuthorizationContextData GetContextData(ICalendar resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'calendar' resource for obtaining authorization context data cannot be null."); var entity = resource as Calendar; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -336,7 +331,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Calendar) resource); } @@ -346,20 +341,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CalendarDate table of the CalendarDate aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CalendarDateRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CalendarDateRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICalendarDate resource) + public RelationshipsAuthorizationContextData GetContextData(ICalendarDate resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'calendarDate' resource for obtaining authorization context data cannot be null."); var entity = resource as CalendarDate; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -380,7 +374,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CalendarDate) resource); } @@ -390,20 +384,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ChartOfAccount table of the ChartOfAccount aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ChartOfAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ChartOfAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IChartOfAccount resource) + public RelationshipsAuthorizationContextData GetContextData(IChartOfAccount resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'chartOfAccount' resource for obtaining authorization context data cannot be null."); var entity = resource as ChartOfAccount; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -424,7 +417,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ChartOfAccount) resource); } @@ -434,20 +427,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ClassPeriod table of the ClassPeriod aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ClassPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ClassPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IClassPeriod resource) + public RelationshipsAuthorizationContextData GetContextData(IClassPeriod resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'classPeriod' resource for obtaining authorization context data cannot be null."); var entity = resource as ClassPeriod; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -468,7 +460,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ClassPeriod) resource); } @@ -478,20 +470,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Cohort table of the Cohort aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CohortRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CohortRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICohort resource) + public RelationshipsAuthorizationContextData GetContextData(ICohort resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'cohort' resource for obtaining authorization context data cannot be null."); var entity = resource as Cohort; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -512,7 +503,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Cohort) resource); } @@ -522,20 +513,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityOrganization table of the CommunityOrganization aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityOrganization resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityOrganization resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityOrganization' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityOrganization; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.CommunityOrganizationId = entity.CommunityOrganizationId == default(long) ? null as long? : entity.CommunityOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -556,7 +546,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityOrganization) resource); } @@ -566,20 +556,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityProvider table of the CommunityProvider aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityProviderRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityProviderRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityProvider resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityProvider resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityProvider' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityProvider; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CommunityOrganizationId = entity.CommunityOrganizationId, // Not part of primary key contextData.CommunityProviderId = entity.CommunityProviderId == default(long) ? null as long? : entity.CommunityProviderId; // Primary key property, Only Education Organization Id present return contextData; @@ -602,7 +591,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityProvider) resource); } @@ -612,20 +601,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CommunityProviderLicense table of the CommunityProviderLicense aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CommunityProviderLicenseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CommunityProviderLicenseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICommunityProviderLicense resource) + public RelationshipsAuthorizationContextData GetContextData(ICommunityProviderLicense resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'communityProviderLicense' resource for obtaining authorization context data cannot be null."); var entity = resource as CommunityProviderLicense; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.CommunityProviderId = entity.CommunityProviderId == default(long) ? null as long? : entity.CommunityProviderId; // Primary key property, Only Education Organization Id present return contextData; } @@ -646,7 +634,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CommunityProviderLicense) resource); } @@ -656,20 +644,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CompetencyObjective table of the CompetencyObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICompetencyObjective resource) + public RelationshipsAuthorizationContextData GetContextData(ICompetencyObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'competencyObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as CompetencyObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -690,7 +677,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CompetencyObjective) resource); } @@ -700,20 +687,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Contact table of the Contact aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ContactRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ContactRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IContact resource) + public RelationshipsAuthorizationContextData GetContextData(IContact resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'contact' resource for obtaining authorization context data cannot be null."); var entity = resource as Contact; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.ContactUSI = entity.ContactUSI == default(int) ? null as int? : entity.ContactUSI; // Primary key property, USI return contextData; } @@ -734,7 +720,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Contact) resource); } @@ -744,20 +730,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Course table of the Course aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourse resource) + public RelationshipsAuthorizationContextData GetContextData(ICourse resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'course' resource for obtaining authorization context data cannot be null."); var entity = resource as Course; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -778,7 +763,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Course) resource); } @@ -788,20 +773,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CourseOffering table of the CourseOffering aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseOfferingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseOfferingRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourseOffering resource) + public RelationshipsAuthorizationContextData GetContextData(ICourseOffering resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'courseOffering' resource for obtaining authorization context data cannot be null."); var entity = resource as CourseOffering; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -824,7 +808,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CourseOffering) resource); } @@ -834,20 +818,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.CourseTranscript table of the CourseTranscript aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class CourseTranscriptRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class CourseTranscriptRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ICourseTranscript resource) + public RelationshipsAuthorizationContextData GetContextData(ICourseTranscript resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'courseTranscript' resource for obtaining authorization context data cannot be null."); var entity = resource as CourseTranscript; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CourseEducationOrganizationId = entity.CourseEducationOrganizationId, // Primary key property, Role name applied contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ExternalEducationOrganizationId = entity.ExternalEducationOrganizationId, // Role name applied and not part of primary key @@ -876,7 +859,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((CourseTranscript) resource); } @@ -886,20 +869,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.DisciplineAction table of the DisciplineAction aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class DisciplineActionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IDisciplineAction resource) + public RelationshipsAuthorizationContextData GetContextData(IDisciplineAction resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'disciplineAction' resource for obtaining authorization context data cannot be null."); var entity = resource as DisciplineAction; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // AssignmentSchoolId = entity.AssignmentSchoolId, // Role name applied and not part of primary key // ResponsibilitySchoolId = entity.ResponsibilitySchoolId, // Role name applied and not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -924,7 +906,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((DisciplineAction) resource); } @@ -934,20 +916,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.DisciplineIncident table of the DisciplineIncident aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class DisciplineIncidentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class DisciplineIncidentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IDisciplineIncident resource) + public RelationshipsAuthorizationContextData GetContextData(IDisciplineIncident resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'disciplineIncident' resource for obtaining authorization context data cannot be null."); var entity = resource as DisciplineIncident; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -968,7 +949,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((DisciplineIncident) resource); } @@ -978,20 +959,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganization table of the EducationOrganization aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganization resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganization resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganization' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganization; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1012,7 +992,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganization) resource); } @@ -1022,20 +1002,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationInterventionPrescriptionAssociation table of the EducationOrganizationInterventionPrescriptionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationInterventionPrescriptionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationInterventionPrescriptionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationInterventionPrescriptionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationInterventionPrescriptionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationInterventionPrescriptionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationInterventionPrescriptionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // InterventionPrescriptionEducationOrganizationId = entity.InterventionPrescriptionEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1058,7 +1037,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationInterventionPrescriptionAssociation) resource); } @@ -1068,20 +1047,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationNetwork table of the EducationOrganizationNetwork aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationNetworkRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationNetworkRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationNetwork resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationNetwork resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationNetwork' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationNetwork; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationNetworkId = entity.EducationOrganizationNetworkId == default(long) ? null as long? : entity.EducationOrganizationNetworkId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1102,7 +1080,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationNetwork) resource); } @@ -1112,20 +1090,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationNetworkAssociation table of the EducationOrganizationNetworkAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationNetworkAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationNetworkAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationNetworkAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationNetworkAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationNetworkAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationNetworkAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationNetworkId = entity.EducationOrganizationNetworkId == default(long) ? null as long? : entity.EducationOrganizationNetworkId; // Primary key property, Only Education Organization Id present // MemberEducationOrganizationId = entity.MemberEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1148,7 +1125,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationNetworkAssociation) resource); } @@ -1158,20 +1135,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationOrganizationPeerAssociation table of the EducationOrganizationPeerAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationOrganizationPeerAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationOrganizationPeerAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationOrganizationPeerAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationOrganizationPeerAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationOrganizationPeerAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationOrganizationPeerAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // PeerEducationOrganizationId = entity.PeerEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -1194,7 +1170,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationOrganizationPeerAssociation) resource); } @@ -1204,20 +1180,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EducationServiceCenter table of the EducationServiceCenter aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EducationServiceCenterRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EducationServiceCenterRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEducationServiceCenter resource) + public RelationshipsAuthorizationContextData GetContextData(IEducationServiceCenter resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'educationServiceCenter' resource for obtaining authorization context data cannot be null."); var entity = resource as EducationServiceCenter; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationServiceCenterId = entity.EducationServiceCenterId == default(long) ? null as long? : entity.EducationServiceCenterId; // Primary key property, Only Education Organization Id present // StateEducationAgencyId = entity.StateEducationAgencyId, // Not part of primary key return contextData; @@ -1240,7 +1215,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EducationServiceCenter) resource); } @@ -1250,20 +1225,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.EvaluationRubricDimension table of the EvaluationRubricDimension aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class EvaluationRubricDimensionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IEvaluationRubricDimension resource) + public RelationshipsAuthorizationContextData GetContextData(IEvaluationRubricDimension resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'evaluationRubricDimension' resource for obtaining authorization context data cannot be null."); var entity = resource as EvaluationRubricDimension; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied return contextData; } @@ -1284,7 +1258,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((EvaluationRubricDimension) resource); } @@ -1294,20 +1268,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.FeederSchoolAssociation table of the FeederSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class FeederSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class FeederSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IFeederSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IFeederSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'feederSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as FeederSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // FeederSchoolId = entity.FeederSchoolId, // Primary key property, Role name applied contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -1330,7 +1303,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((FeederSchoolAssociation) resource); } @@ -1340,20 +1313,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GeneralStudentProgramAssociation table of the GeneralStudentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GeneralStudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GeneralStudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGeneralStudentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IGeneralStudentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'generalStudentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as GeneralStudentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -1378,7 +1350,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GeneralStudentProgramAssociation) resource); } @@ -1388,20 +1360,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Grade table of the Grade aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradeRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradeRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGrade resource) + public RelationshipsAuthorizationContextData GetContextData(IGrade resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'grade' resource for obtaining authorization context data cannot be null."); var entity = resource as Grade; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -1424,7 +1395,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Grade) resource); } @@ -1434,20 +1405,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GradebookEntry table of the GradebookEntry aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGradebookEntry resource) + public RelationshipsAuthorizationContextData GetContextData(IGradebookEntry resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'gradebookEntry' resource for obtaining authorization context data cannot be null."); var entity = resource as GradebookEntry; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // SchoolId = entity.SchoolId, // Not part of primary key return contextData; } @@ -1468,7 +1438,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GradebookEntry) resource); } @@ -1478,20 +1448,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GradingPeriod table of the GradingPeriod aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GradingPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GradingPeriodRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGradingPeriod resource) + public RelationshipsAuthorizationContextData GetContextData(IGradingPeriod resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'gradingPeriod' resource for obtaining authorization context data cannot be null."); var entity = resource as GradingPeriod; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1512,7 +1481,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GradingPeriod) resource); } @@ -1522,20 +1491,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.GraduationPlan table of the GraduationPlan aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class GraduationPlanRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class GraduationPlanRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IGraduationPlan resource) + public RelationshipsAuthorizationContextData GetContextData(IGraduationPlan resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'graduationPlan' resource for obtaining authorization context data cannot be null."); var entity = resource as GraduationPlan; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1556,7 +1524,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((GraduationPlan) resource); } @@ -1566,20 +1534,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Intervention table of the Intervention aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IIntervention resource) + public RelationshipsAuthorizationContextData GetContextData(IIntervention resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'intervention' resource for obtaining authorization context data cannot be null."); var entity = resource as Intervention; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1600,7 +1567,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Intervention) resource); } @@ -1610,20 +1577,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.InterventionPrescription table of the InterventionPrescription aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionPrescriptionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionPrescriptionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IInterventionPrescription resource) + public RelationshipsAuthorizationContextData GetContextData(IInterventionPrescription resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'interventionPrescription' resource for obtaining authorization context data cannot be null."); var entity = resource as InterventionPrescription; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1644,7 +1610,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((InterventionPrescription) resource); } @@ -1654,20 +1620,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.InterventionStudy table of the InterventionStudy aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class InterventionStudyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class InterventionStudyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IInterventionStudy resource) + public RelationshipsAuthorizationContextData GetContextData(IInterventionStudy resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'interventionStudy' resource for obtaining authorization context data cannot be null."); var entity = resource as InterventionStudy; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // InterventionPrescriptionEducationOrganizationId = entity.InterventionPrescriptionEducationOrganizationId, // Role name applied and not part of primary key return contextData; @@ -1690,7 +1655,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((InterventionStudy) resource); } @@ -1700,20 +1665,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalAccount table of the LocalAccount aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalAccountRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalAccount resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalAccount resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localAccount' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalAccount; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ChartOfAccountEducationOrganizationId = entity.ChartOfAccountEducationOrganizationId, // Role name applied and not part of primary key contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; @@ -1736,7 +1700,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalAccount) resource); } @@ -1746,20 +1710,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalActual table of the LocalActual aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalActualRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalActualRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalActual resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalActual resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localActual' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalActual; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1780,7 +1743,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalActual) resource); } @@ -1790,20 +1753,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalBudget table of the LocalBudget aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalBudgetRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalBudgetRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalBudget resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalBudget resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localBudget' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalBudget; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1824,7 +1786,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalBudget) resource); } @@ -1834,20 +1796,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalContractedStaff table of the LocalContractedStaff aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalContractedStaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalContractedStaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalContractedStaff resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalContractedStaff resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localContractedStaff' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalContractedStaff; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -1870,7 +1831,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalContractedStaff) resource); } @@ -1880,20 +1841,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalEducationAgency table of the LocalEducationAgency aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalEducationAgency resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalEducationAgency resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localEducationAgency' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalEducationAgency; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationServiceCenterId = entity.EducationServiceCenterId, // Not part of primary key contextData.LocalEducationAgencyId = entity.LocalEducationAgencyId == default(long) ? null as long? : entity.LocalEducationAgencyId; // Primary key property, Only Education Organization Id present // ParentLocalEducationAgencyId = entity.ParentLocalEducationAgencyId, // Role name applied and not part of primary key @@ -1920,7 +1880,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalEducationAgency) resource); } @@ -1930,20 +1890,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalEncumbrance table of the LocalEncumbrance aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalEncumbranceRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalEncumbranceRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalEncumbrance resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalEncumbrance resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localEncumbrance' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalEncumbrance; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -1964,7 +1923,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalEncumbrance) resource); } @@ -1974,20 +1933,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.LocalPayroll table of the LocalPayroll aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocalPayrollRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocalPayrollRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocalPayroll resource) + public RelationshipsAuthorizationContextData GetContextData(ILocalPayroll resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'localPayroll' resource for obtaining authorization context data cannot be null."); var entity = resource as LocalPayroll; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2010,7 +1968,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((LocalPayroll) resource); } @@ -2020,20 +1978,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Location table of the Location aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class LocationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class LocationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ILocation resource) + public RelationshipsAuthorizationContextData GetContextData(ILocation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'location' resource for obtaining authorization context data cannot be null."); var entity = resource as Location; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2054,7 +2011,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Location) resource); } @@ -2064,20 +2021,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.OpenStaffPosition table of the OpenStaffPosition aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class OpenStaffPositionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class OpenStaffPositionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IOpenStaffPosition resource) + public RelationshipsAuthorizationContextData GetContextData(IOpenStaffPosition resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'openStaffPosition' resource for obtaining authorization context data cannot be null."); var entity = resource as OpenStaffPosition; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2098,7 +2054,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((OpenStaffPosition) resource); } @@ -2108,20 +2064,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.OrganizationDepartment table of the OrganizationDepartment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class OrganizationDepartmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IOrganizationDepartment resource) + public RelationshipsAuthorizationContextData GetContextData(IOrganizationDepartment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'organizationDepartment' resource for obtaining authorization context data cannot be null."); var entity = resource as OrganizationDepartment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.OrganizationDepartmentId = entity.OrganizationDepartmentId == default(long) ? null as long? : entity.OrganizationDepartmentId; // Primary key property, Only Education Organization Id present // ParentEducationOrganizationId = entity.ParentEducationOrganizationId, // Role name applied and not part of primary key return contextData; @@ -2144,7 +2099,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((OrganizationDepartment) resource); } @@ -2154,20 +2109,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.PostSecondaryEvent table of the PostSecondaryEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PostSecondaryEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PostSecondaryEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPostSecondaryEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IPostSecondaryEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'postSecondaryEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as PostSecondaryEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // PostSecondaryInstitutionId = entity.PostSecondaryInstitutionId, // Not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -2190,7 +2144,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PostSecondaryEvent) resource); } @@ -2200,20 +2154,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.PostSecondaryInstitution table of the PostSecondaryInstitution aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class PostSecondaryInstitutionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class PostSecondaryInstitutionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IPostSecondaryInstitution resource) + public RelationshipsAuthorizationContextData GetContextData(IPostSecondaryInstitution resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'postSecondaryInstitution' resource for obtaining authorization context data cannot be null."); var entity = resource as PostSecondaryInstitution; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.PostSecondaryInstitutionId = entity.PostSecondaryInstitutionId == default(long) ? null as long? : entity.PostSecondaryInstitutionId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2234,7 +2187,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((PostSecondaryInstitution) resource); } @@ -2244,20 +2197,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Program table of the Program aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgram resource) + public RelationshipsAuthorizationContextData GetContextData(IProgram resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'program' resource for obtaining authorization context data cannot be null."); var entity = resource as Program; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2278,7 +2230,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Program) resource); } @@ -2288,20 +2240,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluation table of the ProgramEvaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied return contextData; } @@ -2322,7 +2273,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluation) resource); } @@ -2332,20 +2283,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluationElement table of the ProgramEvaluationElement aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationElementRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluationElement resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluationElement resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluationElement' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluationElement; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied return contextData; } @@ -2366,7 +2316,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluationElement) resource); } @@ -2376,20 +2326,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ProgramEvaluationObjective table of the ProgramEvaluationObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ProgramEvaluationObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IProgramEvaluationObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IProgramEvaluationObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'programEvaluationObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as ProgramEvaluationObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied return contextData; } @@ -2410,7 +2359,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ProgramEvaluationObjective) resource); } @@ -2420,20 +2369,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.ReportCard table of the ReportCard aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class ReportCardRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class ReportCardRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IReportCard resource) + public RelationshipsAuthorizationContextData GetContextData(IReportCard resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'reportCard' resource for obtaining authorization context data cannot be null."); var entity = resource as ReportCard; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // GradingPeriodSchoolId = entity.GradingPeriodSchoolId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -2458,7 +2406,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((ReportCard) resource); } @@ -2468,20 +2416,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.RestraintEvent table of the RestraintEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class RestraintEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class RestraintEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IRestraintEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IRestraintEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'restraintEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as RestraintEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -2504,7 +2451,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((RestraintEvent) resource); } @@ -2514,20 +2461,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.School table of the School aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SchoolRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SchoolRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISchool resource) + public RelationshipsAuthorizationContextData GetContextData(ISchool resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'school' resource for obtaining authorization context data cannot be null."); var entity = resource as School; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // LocalEducationAgencyId = entity.LocalEducationAgencyId, // Not part of primary key contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -2550,7 +2496,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((School) resource); } @@ -2560,20 +2506,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Section table of the Section aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SectionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SectionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISection resource) + public RelationshipsAuthorizationContextData GetContextData(ISection resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'section' resource for obtaining authorization context data cannot be null."); var entity = resource as Section; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // LocationSchoolId = entity.LocationSchoolId, // Role name applied and not part of primary key contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; @@ -2596,7 +2541,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Section) resource); } @@ -2606,20 +2551,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SectionAttendanceTakenEvent table of the SectionAttendanceTakenEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SectionAttendanceTakenEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SectionAttendanceTakenEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISectionAttendanceTakenEvent resource) + public RelationshipsAuthorizationContextData GetContextData(ISectionAttendanceTakenEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'sectionAttendanceTakenEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as SectionAttendanceTakenEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present // StaffUSI = entity.StaffUSI, // Not part of primary key return contextData; @@ -2642,7 +2586,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SectionAttendanceTakenEvent) resource); } @@ -2652,20 +2596,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Session table of the Session aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SessionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SessionRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISession resource) + public RelationshipsAuthorizationContextData GetContextData(ISession resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'session' resource for obtaining authorization context data cannot be null."); var entity = resource as Session; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -2686,7 +2629,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Session) resource); } @@ -2696,20 +2639,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Staff table of the Staff aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaff resource) + public RelationshipsAuthorizationContextData GetContextData(IStaff resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staff' resource for obtaining authorization context data cannot be null."); var entity = resource as Staff; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -2730,7 +2672,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Staff) resource); } @@ -2740,20 +2682,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffAbsenceEvent table of the StaffAbsenceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffAbsenceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffAbsenceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffAbsenceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffAbsenceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffAbsenceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffAbsenceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -2774,7 +2715,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffAbsenceEvent) resource); } @@ -2784,20 +2725,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffCohortAssociation table of the StaffCohortAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffCohortAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffCohortAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffCohortAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffCohortAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2820,7 +2760,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffCohortAssociation) resource); } @@ -2830,20 +2770,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffDisciplineIncidentAssociation table of the StaffDisciplineIncidentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffDisciplineIncidentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffDisciplineIncidentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffDisciplineIncidentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffDisciplineIncidentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffDisciplineIncidentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2866,7 +2805,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffDisciplineIncidentAssociation) resource); } @@ -2876,20 +2815,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationAssignmentAssociation table of the StaffEducationOrganizationAssignmentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationAssignmentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationAssignmentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationAssignmentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationAssignmentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationAssignmentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationAssignmentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // EmploymentEducationOrganizationId = entity.EmploymentEducationOrganizationId, // Role name applied and not part of primary key contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI @@ -2914,7 +2852,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationAssignmentAssociation) resource); } @@ -2924,20 +2862,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationContactAssociation table of the StaffEducationOrganizationContactAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationContactAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationContactAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationContactAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationContactAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -2960,7 +2897,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationContactAssociation) resource); } @@ -2970,20 +2907,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffEducationOrganizationEmploymentAssociation table of the StaffEducationOrganizationEmploymentAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffEducationOrganizationEmploymentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffEducationOrganizationEmploymentAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffEducationOrganizationEmploymentAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffEducationOrganizationEmploymentAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffEducationOrganizationEmploymentAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffEducationOrganizationEmploymentAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -3006,7 +2942,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffEducationOrganizationEmploymentAssociation) resource); } @@ -3016,20 +2952,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffLeave table of the StaffLeave aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffLeaveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffLeaveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffLeave resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffLeave resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffLeave' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffLeave; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -3050,7 +2985,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffLeave) resource); } @@ -3060,20 +2995,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffProgramAssociation table of the StaffProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -3096,7 +3030,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffProgramAssociation) resource); } @@ -3106,20 +3040,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffSchoolAssociation table of the StaffSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -3142,7 +3075,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffSchoolAssociation) resource); } @@ -3152,20 +3085,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StaffSectionAssociation table of the StaffSectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StaffSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StaffSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStaffSectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStaffSectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'staffSectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StaffSectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; @@ -3188,7 +3120,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StaffSectionAssociation) resource); } @@ -3198,20 +3130,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StateEducationAgency table of the StateEducationAgency aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StateEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StateEducationAgencyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStateEducationAgency resource) + public RelationshipsAuthorizationContextData GetContextData(IStateEducationAgency resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'stateEducationAgency' resource for obtaining authorization context data cannot be null."); var entity = resource as StateEducationAgency; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StateEducationAgencyId = entity.StateEducationAgencyId == default(long) ? null as long? : entity.StateEducationAgencyId; // Primary key property, Only Education Organization Id present return contextData; } @@ -3232,7 +3163,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StateEducationAgency) resource); } @@ -3242,20 +3173,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Student table of the Student aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'student' resource for obtaining authorization context data cannot be null."); var entity = resource as Student; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; } @@ -3276,7 +3206,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Student) resource); } @@ -3286,20 +3216,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAcademicRecord table of the StudentAcademicRecord aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAcademicRecordRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAcademicRecordRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAcademicRecord resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAcademicRecord resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAcademicRecord' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAcademicRecord; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3322,7 +3251,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAcademicRecord) resource); } @@ -3332,20 +3261,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAssessment table of the StudentAssessment aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAssessmentRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAssessment resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAssessment resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAssessment' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAssessment; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ReportedSchoolId = entity.ReportedSchoolId, // Role name applied and not part of primary key contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3368,7 +3296,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAssessment) resource); } @@ -3378,20 +3306,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentAssessmentEducationOrganizationAssociation table of the StudentAssessmentEducationOrganizationAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentAssessmentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentAssessmentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentAssessmentEducationOrganizationAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentAssessmentEducationOrganizationAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentAssessmentEducationOrganizationAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentAssessmentEducationOrganizationAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3414,7 +3341,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentAssessmentEducationOrganizationAssociation) resource); } @@ -3424,20 +3351,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCohortAssociation table of the StudentCohortAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCohortAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCohortAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCohortAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCohortAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCohortAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3460,7 +3386,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCohortAssociation) resource); } @@ -3470,20 +3396,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCompetencyObjective table of the StudentCompetencyObjective aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCompetencyObjectiveRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCompetencyObjective resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCompetencyObjective resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCompetencyObjective' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCompetencyObjective; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // GradingPeriodSchoolId = entity.GradingPeriodSchoolId, // Primary key property, Role name applied // ObjectiveEducationOrganizationId = entity.ObjectiveEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3508,7 +3433,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCompetencyObjective) resource); } @@ -3518,20 +3443,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentContactAssociation table of the StudentContactAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentContactAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentContactAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentContactAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentContactAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentContactAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.ContactUSI = entity.ContactUSI == default(int) ? null as int? : entity.ContactUSI; // Primary key property, USI contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3554,7 +3478,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentContactAssociation) resource); } @@ -3564,20 +3488,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentCTEProgramAssociation table of the StudentCTEProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentCTEProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentCTEProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentCTEProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentCTEProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentCTEProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentCTEProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3602,7 +3525,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentCTEProgramAssociation) resource); } @@ -3612,20 +3535,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentDisciplineIncidentBehaviorAssociation table of the StudentDisciplineIncidentBehaviorAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentDisciplineIncidentBehaviorAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentDisciplineIncidentBehaviorAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentDisciplineIncidentBehaviorAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentDisciplineIncidentBehaviorAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentDisciplineIncidentBehaviorAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentDisciplineIncidentBehaviorAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3648,7 +3570,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentDisciplineIncidentBehaviorAssociation) resource); } @@ -3658,20 +3580,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentDisciplineIncidentNonOffenderAssociation table of the StudentDisciplineIncidentNonOffenderAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentDisciplineIncidentNonOffenderAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentDisciplineIncidentNonOffenderAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentDisciplineIncidentNonOffenderAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentDisciplineIncidentNonOffenderAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentDisciplineIncidentNonOffenderAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentDisciplineIncidentNonOffenderAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3694,7 +3615,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentDisciplineIncidentNonOffenderAssociation) resource); } @@ -3704,20 +3625,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentEducationOrganizationAssociation table of the StudentEducationOrganizationAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentEducationOrganizationAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentEducationOrganizationAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentEducationOrganizationAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentEducationOrganizationAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentEducationOrganizationAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3740,7 +3660,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentEducationOrganizationAssociation) resource); } @@ -3750,20 +3670,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentEducationOrganizationResponsibilityAssociation table of the StudentEducationOrganizationResponsibilityAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentEducationOrganizationResponsibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentEducationOrganizationResponsibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentEducationOrganizationResponsibilityAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentEducationOrganizationResponsibilityAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentEducationOrganizationResponsibilityAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentEducationOrganizationResponsibilityAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3786,7 +3705,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentEducationOrganizationResponsibilityAssociation) resource); } @@ -3796,20 +3715,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentGradebookEntry table of the StudentGradebookEntry aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentGradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentGradebookEntryRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentGradebookEntry resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentGradebookEntry resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentGradebookEntry' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentGradebookEntry; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; } @@ -3830,7 +3748,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentGradebookEntry) resource); } @@ -3840,20 +3758,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentHealth table of the StudentHealth aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentHealthRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentHealthRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentHealth resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentHealth resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentHealth' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentHealth; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -3876,7 +3793,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentHealth) resource); } @@ -3886,20 +3803,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentHomelessProgramAssociation table of the StudentHomelessProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentHomelessProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentHomelessProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentHomelessProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentHomelessProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentHomelessProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentHomelessProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3924,7 +3840,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentHomelessProgramAssociation) resource); } @@ -3934,20 +3850,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentInterventionAssociation table of the StudentInterventionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentInterventionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentInterventionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentInterventionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentInterventionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentInterventionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentInterventionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // CohortEducationOrganizationId = entity.CohortEducationOrganizationId, // Role name applied and not part of primary key contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -3972,7 +3887,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentInterventionAssociation) resource); } @@ -3982,20 +3897,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentInterventionAttendanceEvent table of the StudentInterventionAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentInterventionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentInterventionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentInterventionAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentInterventionAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentInterventionAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentInterventionAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4018,7 +3932,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentInterventionAttendanceEvent) resource); } @@ -4028,20 +3942,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentLanguageInstructionProgramAssociation table of the StudentLanguageInstructionProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentLanguageInstructionProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentLanguageInstructionProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentLanguageInstructionProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentLanguageInstructionProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentLanguageInstructionProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentLanguageInstructionProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4066,7 +3979,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentLanguageInstructionProgramAssociation) resource); } @@ -4076,20 +3989,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentMigrantEducationProgramAssociation table of the StudentMigrantEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentMigrantEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentMigrantEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentMigrantEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentMigrantEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentMigrantEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentMigrantEducationProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4114,7 +4026,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentMigrantEducationProgramAssociation) resource); } @@ -4124,20 +4036,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentNeglectedOrDelinquentProgramAssociation table of the StudentNeglectedOrDelinquentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentNeglectedOrDelinquentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentNeglectedOrDelinquentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentNeglectedOrDelinquentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentNeglectedOrDelinquentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentNeglectedOrDelinquentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentNeglectedOrDelinquentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4162,7 +4073,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentNeglectedOrDelinquentProgramAssociation) resource); } @@ -4172,20 +4083,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentProgramAssociation table of the StudentProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4210,7 +4120,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentProgramAssociation) resource); } @@ -4220,20 +4130,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentProgramAttendanceEvent table of the StudentProgramAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentProgramAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentProgramAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentProgramAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentProgramAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentProgramAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentProgramAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4258,7 +4167,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentProgramAttendanceEvent) resource); } @@ -4268,20 +4177,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentProgramEvaluation table of the StudentProgramEvaluation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentProgramEvaluationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentProgramEvaluation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentProgramEvaluation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentProgramEvaluation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentProgramEvaluation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied // StaffEvaluatorStaffUSI = entity.StaffEvaluatorStaffUSI, // Not part of primary key @@ -4308,7 +4216,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentProgramEvaluation) resource); } @@ -4318,20 +4226,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolAssociation table of the StudentSchoolAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // NextYearSchoolId = entity.NextYearSchoolId, // Role name applied and not part of primary key contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present @@ -4358,7 +4265,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolAssociation) resource); } @@ -4368,20 +4275,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolAttendanceEvent table of the StudentSchoolAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4404,7 +4310,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolAttendanceEvent) resource); } @@ -4414,20 +4320,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSchoolFoodServiceProgramAssociation table of the StudentSchoolFoodServiceProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSchoolFoodServiceProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSchoolFoodServiceProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSchoolFoodServiceProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSchoolFoodServiceProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSchoolFoodServiceProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSchoolFoodServiceProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4452,7 +4357,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSchoolFoodServiceProgramAssociation) resource); } @@ -4462,20 +4367,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSectionAssociation table of the StudentSectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4498,7 +4402,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSectionAssociation) resource); } @@ -4508,20 +4412,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSectionAttendanceEvent table of the StudentSectionAttendanceEvent aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSectionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSectionAttendanceEventRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSectionAttendanceEvent resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSectionAttendanceEvent resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSectionAttendanceEvent' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSectionAttendanceEvent; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4544,7 +4447,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSectionAttendanceEvent) resource); } @@ -4554,20 +4457,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSpecialEducationProgramAssociation table of the StudentSpecialEducationProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSpecialEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSpecialEducationProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSpecialEducationProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSpecialEducationProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSpecialEducationProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSpecialEducationProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4592,7 +4494,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSpecialEducationProgramAssociation) resource); } @@ -4602,20 +4504,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentSpecialEducationProgramEligibilityAssociation table of the StudentSpecialEducationProgramEligibilityAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentSpecialEducationProgramEligibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentSpecialEducationProgramEligibilityAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentSpecialEducationProgramEligibilityAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentSpecialEducationProgramEligibilityAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentSpecialEducationProgramEligibilityAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentSpecialEducationProgramEligibilityAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI return contextData; @@ -4638,7 +4539,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentSpecialEducationProgramEligibilityAssociation) resource); } @@ -4648,20 +4549,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentTitleIPartAProgramAssociation table of the StudentTitleIPartAProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentTitleIPartAProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentTitleIPartAProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentTitleIPartAProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentTitleIPartAProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentTitleIPartAProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentTitleIPartAProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present // ProgramEducationOrganizationId = entity.ProgramEducationOrganizationId, // Primary key property, Role name applied contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI @@ -4686,7 +4586,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentTitleIPartAProgramAssociation) resource); } @@ -4696,20 +4596,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.StudentTransportation table of the StudentTransportation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class StudentTransportationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class StudentTransportationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(IStudentTransportation resource) + public RelationshipsAuthorizationContextData GetContextData(IStudentTransportation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'studentTransportation' resource for obtaining authorization context data cannot be null."); var entity = resource as StudentTransportation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StudentUSI = entity.StudentUSI == default(int) ? null as int? : entity.StudentUSI; // Primary key property, USI // TransportationEducationOrganizationId = entity.TransportationEducationOrganizationId, // Primary key property, Role name applied return contextData; @@ -4732,7 +4631,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((StudentTransportation) resource); } @@ -4742,20 +4641,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.Survey table of the Survey aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurvey resource) + public RelationshipsAuthorizationContextData GetContextData(ISurvey resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'survey' resource for obtaining authorization context data cannot be null."); var entity = resource as Survey; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // EducationOrganizationId = entity.EducationOrganizationId, // Not part of primary key // SchoolId = entity.SchoolId, // Not part of primary key return contextData; @@ -4778,7 +4676,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((Survey) resource); } @@ -4788,20 +4686,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyCourseAssociation table of the SurveyCourseAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyCourseAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyCourseAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyCourseAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyCourseAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyCourseAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyCourseAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4822,7 +4719,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyCourseAssociation) resource); } @@ -4832,20 +4729,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyProgramAssociation table of the SurveyProgramAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyProgramAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyProgramAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyProgramAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyProgramAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyProgramAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4866,7 +4762,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyProgramAssociation) resource); } @@ -4876,20 +4772,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponse table of the SurveyResponse aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponse resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponse resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponse' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponse; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); // ContactUSI = entity.ContactUSI, // Not part of primary key // StaffUSI = entity.StaffUSI, // Not part of primary key // StudentUSI = entity.StudentUSI, // Not part of primary key @@ -4914,7 +4809,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponse) resource); } @@ -4924,20 +4819,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponseEducationOrganizationTargetAssociation table of the SurveyResponseEducationOrganizationTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponseEducationOrganizationTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponseEducationOrganizationTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponseEducationOrganizationTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponseEducationOrganizationTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -4958,7 +4852,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponseEducationOrganizationTargetAssociation) resource); } @@ -4968,20 +4862,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveyResponseStaffTargetAssociation table of the SurveyResponseStaffTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveyResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveyResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveyResponseStaffTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveyResponseStaffTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveyResponseStaffTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveyResponseStaffTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -5002,7 +4895,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveyResponseStaffTargetAssociation) resource); } @@ -5012,20 +4905,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionAssociation table of the SurveySectionAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.SchoolId = entity.SchoolId == default(long) ? null as long? : entity.SchoolId; // Primary key property, Only Education Organization Id present return contextData; } @@ -5046,7 +4938,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionAssociation) resource); } @@ -5056,20 +4948,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionResponseEducationOrganizationTargetAssociation table of the SurveySectionResponseEducationOrganizationTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionResponseEducationOrganizationTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionResponseEducationOrganizationTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionResponseEducationOrganizationTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionResponseEducationOrganizationTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionResponseEducationOrganizationTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.EducationOrganizationId = entity.EducationOrganizationId == default(long) ? null as long? : entity.EducationOrganizationId; // Primary key property, Only Education Organization Id present return contextData; } @@ -5090,7 +4981,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionResponseEducationOrganizationTargetAssociation) resource); } @@ -5100,20 +4991,19 @@ public TContextData GetContextData(object resource) /// Creates and returns an instance for making authorization decisions for access to the edfi.SurveySectionResponseStaffTargetAssociation table of the SurveySectionResponseStaffTargetAssociation aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class SurveySectionResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class SurveySectionResponseStaffTargetAssociationRelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(ISurveySectionResponseStaffTargetAssociation resource) + public RelationshipsAuthorizationContextData GetContextData(ISurveySectionResponseStaffTargetAssociation resource) { if (resource == null) throw new ArgumentNullException("resource", "The 'surveySectionResponseStaffTargetAssociation' resource for obtaining authorization context data cannot be null."); var entity = resource as SurveySectionResponseStaffTargetAssociation; - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); contextData.StaffUSI = entity.StaffUSI == default(int) ? null as int? : entity.StaffUSI; // Primary key property, USI return contextData; } @@ -5134,7 +5024,7 @@ public string[] GetAuthorizationContextPropertyNames() /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData((SurveySectionResponseStaffTargetAssociation) resource); } diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Generators/EntityAuthorizationContextProviders.cs b/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Generators/EntityAuthorizationContextProviders.cs index 704c5d7cbc..a763ec230f 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Generators/EntityAuthorizationContextProviders.cs +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Generators/EntityAuthorizationContextProviders.cs @@ -22,7 +22,7 @@ public class EntityAuthorizationContextProviders : GeneratorBase private const string EducationOrganizationKey = "EducationOrganizationId"; private Dictionary> _authorizationPropertiesByResource; private IEnumerable _primaryKeysInheritedFromEducationOrganization; - private ResourceModel _resourceModel; + private IResourceModel _resourceModel; private IEnumerable _resourcesToRender; private IEnumerable EducationOrganizationColumns diff --git a/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Mustache/EntityAuthorizationContextProviders.mustache b/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Mustache/EntityAuthorizationContextProviders.mustache index 4c7267c30d..55c1a62f91 100644 --- a/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Mustache/EntityAuthorizationContextProviders.mustache +++ b/Utilities/CodeGeneration/EdFi.Ods.CodeGen/Mustache/EntityAuthorizationContextProviders.mustache @@ -20,13 +20,12 @@ namespace {{ContextDataProviderNamespace}} /// Creates and returns an instance for making authorization decisions for access to the {{Schema}}.{{ResourceName}} table of the {{ResourceName}} aggregate in the Ods Database. /// [ExcludeFromCodeCoverage] - public class {{ResourceName}}RelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider - where TContextData : RelationshipsAuthorizationContextData, new() + public class {{ResourceName}}RelationshipsAuthorizationContextDataProvider : IRelationshipsAuthorizationContextDataProvider { /// - /// Creates and returns an instance based on the supplied resource. + /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(I{{ResourceName}} resource) + public RelationshipsAuthorizationContextData GetContextData(I{{ResourceName}} resource) { if (resource == null) throw new ArgumentNullException("resource", "The '{{ResourceNameCamelCase}}' resource for obtaining authorization context data cannot be null."); @@ -34,10 +33,10 @@ namespace {{ContextDataProviderNamespace}} var entity = resource as {{ResourceName}}; {{#SchemaIsEdFi}} - var contextData = new TContextData(); + var contextData = new RelationshipsAuthorizationContextData(); {{/SchemaIsEdFi}} {{^SchemaIsEdFi}} - dynamic contextData = new TContextData(); + dynamic contextData = new RelationshipsAuthorizationContextData(); {{/SchemaIsEdFi}} {{#AuthorizationResourceProperties}} {{#ContextPropertyIsIncludedAndNumeric}} @@ -51,7 +50,7 @@ namespace {{ContextDataProviderNamespace}} return contextData; {{/SchemaIsEdFi}} {{^SchemaIsEdFi}} - return (TContextData) contextData; + return (RelationshipsAuthorizationContextData) contextData; {{/SchemaIsEdFi}} } @@ -78,7 +77,7 @@ namespace {{ContextDataProviderNamespace}} /// /// Creates and returns an instance based on the supplied resource. /// - public TContextData GetContextData(object resource) + public RelationshipsAuthorizationContextData GetContextData(object resource) { return GetContextData(({{ResourceName}}) resource); }