Skip to content

Commit

Permalink
Remove search scope requirement from DialogCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Feb 21, 2025
1 parent dd4a013 commit 70a329f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/schema/V1/swagger.verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -6118,8 +6118,7 @@
"security": [
{
"JWTBearerAuth": [
"digdir:dialogporten.serviceprovider",
"digdir:dialogporten.serviceprovider.search"
"digdir:dialogporten.serviceprovider"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Digdir.Domain.Dialogporten.Application.Common.Authorization;
using Digdir.Domain.Dialogporten.WebApi.Endpoints.V1.EndUser;
using Digdir.Domain.Dialogporten.WebApi.Endpoints.V1.ServiceOwner;

using NSwag;
using NSwag.Generation.Processors;
using NSwag.Generation.Processors.Contexts;

Expand All @@ -24,7 +24,7 @@ public bool Process(OperationProcessorContext context)
context.OperationDescription.Operation.Tags.FirstOrDefault() switch
{
var tag when string.Equals(tag, ServiceOwnerGroup.RoutePrefix, StringComparison.OrdinalIgnoreCase)
=> IsServiceOwnerSearchEndpoint(context)
=> IsServiceOwnerSearchEndpoint(context.OperationDescription)
? new[] { AuthorizationScope.ServiceProvider, AuthorizationScope.ServiceProviderSearch }
: new[] { AuthorizationScope.ServiceProvider },

Expand All @@ -37,6 +37,6 @@ var tag when string.Equals(tag, EndUserGroup.RoutePrefix, StringComparison.Ordin
return true;
}

private static bool IsServiceOwnerSearchEndpoint(OperationProcessorContext context)
=> context.OperationDescription.Path == ServiceOwnerSearchPath;
private static bool IsServiceOwnerSearchEndpoint(OpenApiOperationDescription description)
=> description is { Path: ServiceOwnerSearchPath, Method: OpenApiOperationMethod.Get };
}

0 comments on commit 70a329f

Please sign in to comment.