-
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.
Implemented relationship-based auth view failure hints, and made auth…
…orization failure messages returned when a referenced person exists indistinguishable from when it does not (missed ODS-6031 requirement).
- Loading branch information
1 parent
273cf61
commit 16df015
Showing
9 changed files
with
229 additions
and
71 deletions.
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
...onships/Filters/Hints/EducationOrganizationIdToContactUsiAuthorizationViewHintProvider.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,19 @@ | ||
// 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. | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
public class EducationOrganizationIdToContactUsiAuthorizationViewHintProvider : IAuthorizationViewHintProvider | ||
{ | ||
public string GetFailureHint(string viewName) | ||
{ | ||
if (viewName.StartsWith("EducationOrganizationIdToContactUSI")) | ||
{ | ||
return "Ensure that the corresponding 'StudentSchoolAssociation' and 'StudentContactAssociation' resource items have been created."; | ||
} | ||
|
||
return null; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ionships/Filters/Hints/EducationOrganizationIdToParentUsiAuthorizationViewHintProvider.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,21 @@ | ||
// 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; | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
public class EducationOrganizationIdToParentUsiAuthorizationViewHintProvider : IAuthorizationViewHintProvider | ||
{ | ||
public string GetFailureHint(string viewName) | ||
{ | ||
if (viewName.StartsWith("EducationOrganizationIdToParentUSI", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return "Ensure that the corresponding 'StudentSchoolAssociation' and 'StudentParentAssociation' resource items have been created."; | ||
} | ||
|
||
return null; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...tionships/Filters/Hints/EducationOrganizationIdToStaffUsiAuthorizationViewHintProvider.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,21 @@ | ||
// 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; | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
public class EducationOrganizationIdToStaffUsiAuthorizationViewHintProvider : IAuthorizationViewHintProvider | ||
{ | ||
public string GetFailureHint(string viewName) | ||
{ | ||
if (viewName.StartsWith("EducationOrganizationIdToStaffUSI", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return "Ensure that a corresponding 'StaffEducationOrganizationEmploymentAssociation' or 'StaffEducationOrganizationAssignmentAssociation' resource item has been created."; | ||
} | ||
|
||
return null; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...onships/Filters/Hints/EducationOrganizationIdToStudentUsiAuthorizationViewHintProvider.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,22 @@ | ||
// 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; | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
public class EducationOrganizationIdToStudentUsiAuthorizationViewHintProvider : IAuthorizationViewHintProvider | ||
{ | ||
public string GetFailureHint(string viewName) | ||
{ | ||
if (viewName.Equals("EducationOrganizationIdToStudentUSI", StringComparison.OrdinalIgnoreCase) | ||
|| viewName.Equals("EducationOrganizationIdToStudentUSIIncludingDeletes", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return "Ensure that a corresponding 'StudentSchoolAssociation' resource item has been created."; | ||
} | ||
|
||
return null; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
.../EducationOrganizationIdToStudentUsiThroughResponsibilityAuthorizationViewHintProvider.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,23 @@ | ||
// 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; | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
public class EducationOrganizationIdToStudentUsiThroughResponsibilityAuthorizationViewHintProvider | ||
: IAuthorizationViewHintProvider | ||
{ | ||
public string GetFailureHint(string viewName) | ||
{ | ||
if (viewName.StartsWith("EducationOrganizationIdToStudentUSIThrough", StringComparison.OrdinalIgnoreCase) | ||
&& viewName.EndsWith("Responsibility", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return "Ensure that a corresponding 'StudentEducationOrganizationResponsibilityAssociation' resource item has been created."; | ||
} | ||
|
||
return null; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ity/AuthorizationStrategies/Relationships/Filters/Hints/IAuthorizationViewHintProvider.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,14 @@ | ||
// 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. | ||
|
||
namespace EdFi.Ods.Api.Security.AuthorizationStrategies.Relationships.Filters.Hints; | ||
|
||
/// <summary> | ||
/// Defines a method for obtaining a hint to be included with the Problem Details response when view-based authorization fails. | ||
/// </summary> | ||
public interface IAuthorizationViewHintProvider | ||
{ | ||
string GetFailureHint(string viewName); | ||
} |
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
Oops, something went wrong.