From 275f2845a124d2f5b9ca783175b51cb9861ac632 Mon Sep 17 00:00:00 2001 From: "m.semalaiappan" Date: Tue, 29 Oct 2024 11:52:24 -0500 Subject: [PATCH] Update security metadata for StudentContactAssociation (and StudentParentAssociation) --- ...ParentAssociation-authorized-on-StudentOnly.sql | 11 ++++++++--- ...ParentAssociation-authorized-on-StudentOnly.xml | 2 +- ...ParentAssociation-authorized-on-StudentOnly.sql | 11 ++++++++--- ...ParentAssociation-authorized-on-StudentOnly.xml | 2 +- ...ontactAssociation-authorized-on-StudentOnly.sql | 14 ++++++++++---- ...ontactAssociation-authorized-on-StudentOnly.xml | 2 +- ...ontactAssociation-authorized-on-StudentOnly.sql | 11 ++++++++--- ...ontactAssociation-authorized-on-StudentOnly.xml | 2 +- 8 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql index baad5af732..2d62aeaa19 100644 --- a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql +++ b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql @@ -235,20 +235,25 @@ BEGIN SET @resourceClaimActionId = SCOPE_IDENTITY() + IF NOT EXISTS(SELECT 1 FROM [dbo].[AuthorizationStrategies] WHERE [AuthorizationStrategyName] ='RelationshipsWithStudentsOnlyIncludingDeletes') + BEGIN + INSERT INTO [dbo].[AuthorizationStrategies] ([DisplayName], [AuthorizationStrategyName]) + VALUES ('Relationships With Students Only Including Deletes', 'RelationshipsWithStudentsOnlyIncludingDeletes'); + END SET @authorizationStrategyId = NULL SELECT @authorizationStrategyId = a.AuthorizationStrategyId FROM dbo.AuthorizationStrategies a - WHERE a.AuthorizationStrategyName = 'RelationshipsWithEdOrgsAndPeopleIncludingDeletes' + WHERE a.AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes' IF @authorizationStrategyId IS NULL BEGIN - SET @msg = 'AuthorizationStrategy does not exist: ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'''; + SET @msg = 'AuthorizationStrategy does not exist: ''RelationshipsWithStudentsOnlyIncludingDeletes'''; THROW 50000, @msg, 1 END - PRINT 'Adding authorization strategy ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'' for resource claim ''' + @claimName + ''' (claimId=' + CONVERT(nvarchar, @claimId) + ').' + PRINT 'Adding authorization strategy ''RelationshipsWithStudentsOnlyIncludingDeletes'' for resource claim ''' + @claimName + ''' (claimId=' + CONVERT(nvarchar, @claimId) + ').' INSERT INTO dbo.ResourceClaimActionAuthorizationStrategies(ResourceClaimActionId, AuthorizationStrategyId) VALUES (@resourceClaimActionId, @authorizationStrategyId) diff --git a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml index 45e6060f3d..529c06a401 100644 --- a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml +++ b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/MsSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml @@ -27,7 +27,7 @@ + name="RelationshipsWithStudentsOnlyIncludingDeletes" /> diff --git a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql index 6553a2a59b..c774f9db7f 100644 --- a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql +++ b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.sql @@ -214,18 +214,23 @@ BEGIN RETURNING ResourceClaimActionId INTO resource_claim_action_id; + + IF NOT EXISTS (SELECT 1 FROM dbo.AuthorizationStrategies WHERE AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes') THEN + INSERT INTO dbo.AuthorizationStrategies (DisplayName, AuthorizationStrategyName) + VALUES ('Relationships With Students Only Including Deletes', 'RelationshipsWithStudentsOnlyIncludingDeletes'); + END IF; authorization_strategy_id := NULL; SELECT a.AuthorizationStrategyId INTO authorization_strategy_id FROM dbo.AuthorizationStrategies a - WHERE a.AuthorizationStrategyName = 'RelationshipsWithEdOrgsAndPeopleIncludingDeletes'; + WHERE a.AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes'; IF authorization_strategy_id IS NULL THEN - RAISE EXCEPTION USING MESSAGE = 'AuthorizationStrategy does not exist: ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'''; + RAISE EXCEPTION USING MESSAGE = 'AuthorizationStrategy does not exist: ''RelationshipsWithStudentsOnlyIncludingDeletes'''; END IF; - RAISE NOTICE USING MESSAGE = 'Adding authorization strategy ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'' for resource claim ''' || claim_name || ''' (claimId=' || claim_id || ').'; + RAISE NOTICE USING MESSAGE = 'Adding authorization strategy ''RelationshipsWithStudentsOnlyIncludingDeletes'' for resource claim ''' || claim_name || ''' (claimId=' || claim_id || ').'; INSERT INTO dbo.ResourceClaimActionAuthorizationStrategies(ResourceClaimActionId, AuthorizationStrategyId) VALUES (resource_claim_action_id, authorization_strategy_id); diff --git a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml index 45e6060f3d..529c06a401 100644 --- a/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml +++ b/Application/EdFi.Ods.Standard/Standard/4.0.0/Artifacts/PgSql/Data/Security/2150-StudentParentAssociation-authorized-on-StudentOnly.xml @@ -27,7 +27,7 @@ + name="RelationshipsWithStudentsOnlyIncludingDeletes" /> diff --git a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql index ae4cd84edb..7c488124b5 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql +++ b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql @@ -235,20 +235,26 @@ BEGIN SET @resourceClaimActionId = SCOPE_IDENTITY() - + + IF NOT EXISTS(SELECT 1 FROM [dbo].[AuthorizationStrategies] WHERE [AuthorizationStrategyName] ='RelationshipsWithStudentsOnlyIncludingDeletes') + BEGIN + INSERT INTO [dbo].[AuthorizationStrategies] ([DisplayName], [AuthorizationStrategyName]) + VALUES ('Relationships With Students Only Including Deletes', 'RelationshipsWithStudentsOnlyIncludingDeletes'); + END + SET @authorizationStrategyId = NULL SELECT @authorizationStrategyId = a.AuthorizationStrategyId FROM dbo.AuthorizationStrategies a - WHERE a.AuthorizationStrategyName = 'RelationshipsWithEdOrgsAndPeopleIncludingDeletes' + WHERE a.AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes' IF @authorizationStrategyId IS NULL BEGIN - SET @msg = 'AuthorizationStrategy does not exist: ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'''; + SET @msg = 'AuthorizationStrategy does not exist: ''RelationshipsWithStudentsOnlyIncludingDeletes'''; THROW 50000, @msg, 1 END - PRINT 'Adding authorization strategy ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'' for resource claim ''' + @claimName + ''' (claimId=' + CONVERT(nvarchar, @claimId) + ').' + PRINT 'Adding authorization strategy ''RelationshipsWithStudentsOnlyIncludingDeletes'' for resource claim ''' + @claimName + ''' (claimId=' + CONVERT(nvarchar, @claimId) + ').' INSERT INTO dbo.ResourceClaimActionAuthorizationStrategies(ResourceClaimActionId, AuthorizationStrategyId) VALUES (@resourceClaimActionId, @authorizationStrategyId) diff --git a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml index 73cfac8b20..d0b0fad6f2 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml +++ b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/MsSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml @@ -28,7 +28,7 @@ + name="RelationshipsWithStudentsOnlyIncludingDeletes" /> diff --git a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql index 855de0ecf0..da92d6b94a 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql +++ b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.sql @@ -215,17 +215,22 @@ BEGIN INTO resource_claim_action_id; + IF NOT EXISTS (SELECT 1 FROM dbo.AuthorizationStrategies WHERE AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes') THEN + INSERT INTO dbo.AuthorizationStrategies (DisplayName, AuthorizationStrategyName) + VALUES ('Relationships With Students Only Including Deletes', 'RelationshipsWithStudentsOnlyIncludingDeletes'); + END IF; + authorization_strategy_id := NULL; SELECT a.AuthorizationStrategyId INTO authorization_strategy_id FROM dbo.AuthorizationStrategies a - WHERE a.AuthorizationStrategyName = 'RelationshipsWithEdOrgsAndPeopleIncludingDeletes'; + WHERE a.AuthorizationStrategyName = 'RelationshipsWithStudentsOnlyIncludingDeletes'; IF authorization_strategy_id IS NULL THEN - RAISE EXCEPTION USING MESSAGE = 'AuthorizationStrategy does not exist: ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'''; + RAISE EXCEPTION USING MESSAGE = 'AuthorizationStrategy does not exist: ''RelationshipsWithStudentsOnlyIncludingDeletes'''; END IF; - RAISE NOTICE USING MESSAGE = 'Adding authorization strategy ''RelationshipsWithEdOrgsAndPeopleIncludingDeletes'' for resource claim ''' || claim_name || ''' (claimId=' || claim_id || ').'; + RAISE NOTICE USING MESSAGE = 'Adding authorization strategy ''RelationshipsWithStudentsOnlyIncludingDeletes'' for resource claim ''' || claim_name || ''' (claimId=' || claim_id || ').'; INSERT INTO dbo.ResourceClaimActionAuthorizationStrategies(ResourceClaimActionId, AuthorizationStrategyId) VALUES (resource_claim_action_id, authorization_strategy_id); diff --git a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml index 73cfac8b20..d0b0fad6f2 100644 --- a/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml +++ b/Application/EdFi.Ods.Standard/Standard/5.2.0/Artifacts/PgSql/Data/Security/2160-StudentContactAssociation-authorized-on-StudentOnly.xml @@ -28,7 +28,7 @@ + name="RelationshipsWithStudentsOnlyIncludingDeletes" />