-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AllowIdSignInWithProhibitions member to v3 teacher response
This is a short term solution so that ID can prevent sign in (or registration) of prohibited teachers *unless* a flag has been set on the matched DQT record. As it's for our use only and short term, I've hidden it from the Swagger doc and prefixed the include entry with an '_'.
- Loading branch information
Showing
9 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...dSystem/src/TeachingRecordSystem.Api/Infrastructure/OpenApi/ExcludeFromSchemaAttribute.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,6 @@ | ||
namespace TeachingRecordSystem.Api.Infrastructure.OpenApi; | ||
|
||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] | ||
public sealed class ExcludeFromSchemaAttribute : Attribute | ||
{ | ||
} |
27 changes: 27 additions & 0 deletions
27
...achingRecordSystem.Api/Infrastructure/OpenApi/RemoveExcludedEnumOptionsSchemaProcessor.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,27 @@ | ||
using System.Reflection; | ||
using NJsonSchema.Generation; | ||
|
||
namespace TeachingRecordSystem.Api.Infrastructure.OpenApi; | ||
|
||
public class RemoveExcludedEnumOptionsSchemaProcessor : ISchemaProcessor | ||
{ | ||
public void Process(SchemaProcessorContext context) | ||
{ | ||
var type = context.ContextualType.Type; | ||
|
||
if (!type.IsEnum) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (var memberName in Enum.GetNames(type)) | ||
{ | ||
var member = type.GetField(memberName)!; | ||
if (member.GetCustomAttribute<ExcludeFromSchemaAttribute>() is not null) | ||
{ | ||
context.Schema.Enumeration.Remove(memberName); | ||
context.Schema.EnumerationNames.Remove(memberName); | ||
} | ||
} | ||
} | ||
} |
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