-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODS-6543] Update security metadata for StudentContactAssociation (an…
…d StudentParentAssociation) to eliminate unnecessary join - ReadChanges (#1176)
- Loading branch information
1 parent
6ed0b28
commit 138faf3
Showing
14 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...egies/Relationships/RelationshipsWithStudentsOnlyIncludingDeletesAuthorizationStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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.Collections.Generic; | ||
using System.Linq; | ||
using EdFi.Ods.Common.Models; | ||
using EdFi.Ods.Common.Specifications; | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships | ||
{ | ||
[AuthorizationStrategyName(RelationshipAuthorizationStrategyName)] | ||
public class RelationshipsWithStudentsOnlyIncludingDeletesAuthorizationStrategy | ||
: RelationshipsAuthorizationStrategyBase | ||
{ | ||
private const string RelationshipAuthorizationStrategyName = "RelationshipsWithStudentsOnlyIncludingDeletes"; | ||
|
||
private readonly IPersonEntitySpecification _personEntitySpecification; | ||
|
||
public RelationshipsWithStudentsOnlyIncludingDeletesAuthorizationStrategy( | ||
IDomainModelProvider domainModelProvider, | ||
IPersonEntitySpecification personEntitySpecification) | ||
: base(domainModelProvider) | ||
{ | ||
_personEntitySpecification = personEntitySpecification; | ||
} | ||
|
||
protected override string AuthorizationStrategyName | ||
{ | ||
get => RelationshipAuthorizationStrategyName; | ||
} | ||
|
||
protected override SubjectEndpoint[] GetAuthorizationSubjectEndpoints( | ||
IEnumerable<(string name, object value)> authorizationContextTuples) | ||
{ | ||
return authorizationContextTuples | ||
.Select( | ||
nv => | ||
{ | ||
if (_personEntitySpecification.IsPersonIdentifier(nv.name)) | ||
{ | ||
return new SubjectEndpoint(nv, "IncludingDeletes"); | ||
} | ||
|
||
return new SubjectEndpoint(nv); | ||
}) | ||
.ToArray(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters