-
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-6285] Add hints to relationship-based authorization failure mess…
…ages (#987) Co-authored-by: Jesus Flores <[email protected]>
- Loading branch information
1 parent
3d7d611
commit 6dce58d
Showing
15 changed files
with
776 additions
and
107 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 "You may need to create corresponding 'StudentSchoolAssociation' and 'StudentContactAssociation' resource items."; | ||
} | ||
|
||
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 "You may need to create corresponding 'StudentSchoolAssociation' and 'StudentParentAssociation' resource items."; | ||
} | ||
|
||
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 "You may need to create corresponding 'StaffEducationOrganizationEmploymentAssociation' or 'StaffEducationOrganizationAssignmentAssociation' resource items."; | ||
} | ||
|
||
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 "You may need to create a corresponding 'StudentSchoolAssociation' resource item."; | ||
} | ||
|
||
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 "You may need to create a corresponding 'StudentEducationOrganizationResponsibilityAssociation' resource item."; | ||
} | ||
|
||
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.