Extract group authorisation into a route-level filter #43
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/group-authorisation-helper"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tasks 147 and 148.
PlaceEndpoints.PostCreatePlaceauthorised imperatively (resolveGroupResource, callAuthorizeAsync, throw 403/404 by hand). Extracted toGroupAuthorizationEndpointExtensions.RequireGroupCapability, attached declaratively on the route (.RequireGroupCapability(GroupCapability.MayEditPlaces)).PostCreatePlace's existing 403/404 e2e tests pass unchanged.Chose a filter over an extension method a handler calls — see ADR-0043 for the full weighing. The short version: an extension method is exactly as easy to omit as the code it replaces, which defeats task 148's point. The filter attaches
GroupCapabilityMetadatato the endpoint, so the safety-net test (GroupScopedEndpointAuthorisationTests) can enumerate every route under/api/groups/{groupId}and assert each declares the requirement, without a database.Proved the safety net: removed
.RequireGroupCapability(...)from the create-place route, confirmedGroupScopedEndpointAuthorisationTestsreddened (listing that exact endpoint as missing the requirement), then restored it and confirmed green.Full local CI sequence run under the pinned SDK (10.0.100): restore, build (Release), test (Release, 581 tests),
dotnet format --verify-no-changes— all clean.