Skip to content

Commit

Permalink
Update security metadata for StudentContactAssociation (and StudentPa…
Browse files Browse the repository at this point in the history
…rentAssociation)
  • Loading branch information
semalaiappan committed Oct 29, 2024
1 parent 8755adb commit 275f284
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Action name="ReadChanges">
<AuthorizationStrategies>
<AuthorizationStrategy
name="RelationshipsWithEdOrgsAndPeopleIncludingDeletes" />
name="RelationshipsWithStudentsOnlyIncludingDeletes" />
</AuthorizationStrategies>
</Action>
</DefaultAuthorization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Action name="ReadChanges">
<AuthorizationStrategies>
<AuthorizationStrategy
name="RelationshipsWithEdOrgsAndPeopleIncludingDeletes" />
name="RelationshipsWithStudentsOnlyIncludingDeletes" />
</AuthorizationStrategies>
</Action>
</DefaultAuthorization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Action name="ReadChanges">
<AuthorizationStrategies>
<AuthorizationStrategy
name="RelationshipsWithEdOrgsAndPeopleIncludingDeletes" />
name="RelationshipsWithStudentsOnlyIncludingDeletes" />
</AuthorizationStrategies>
</Action>
</DefaultAuthorization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Action name="ReadChanges">
<AuthorizationStrategies>
<AuthorizationStrategy
name="RelationshipsWithEdOrgsAndPeopleIncludingDeletes" />
name="RelationshipsWithStudentsOnlyIncludingDeletes" />
</AuthorizationStrategies>
</Action>
</DefaultAuthorization>
Expand Down

0 comments on commit 275f284

Please sign in to comment.