Public Access: Honour custom IMemberGroupService in backoffice dialog (closes #22580)#22588
Conversation
|
Claude finished @AndyButland's task in 5m 51s —— View job PR ReviewTarget: Fixes the Public Access dialog not honouring custom
Suggestions
Approved with Suggestions for improvementGood to go, but please carefully consider the importance of the suggestions. The breaking-change mitigations (Pattern 1 on both constructors, Pattern 3 on the interface) are applied correctly and the removal target version (v19 = 17 + 2) is right. The new |
There was a problem hiding this comment.
Pull request overview
This PR fixes Public Access UI/API behavior to honor custom IMemberGroupService implementations (e.g., external user stores) when resolving member groups, addressing #22580.
Changes:
- Public Access dialog group resolution now uses
IMemberGroupService.GetByName(...)instead of querying roles/entities directly. - Added
IMemberGroupService.GetAsync(IEnumerable<Guid> keys)bulk lookup, with an efficient override inMemberGroupService. - Updated management API member-group item endpoint and mapping to work with
IMemberGroupsources; adjusted/added tests accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Management/Factories/PublicAccessPresentationFactoryTests.cs | Updates unit tests to mock IMemberGroupService for group resolution. |
| tests/Umbraco.Tests.Integration/Umbraco.Core/Services/MemberGroupServiceTests.cs | Adds integration test validating bulk lookup by keys. |
| src/Umbraco.Core/Services/MemberGroupService.cs | Implements efficient GetAsync(IEnumerable<Guid>) using repository query. |
| src/Umbraco.Core/Services/IMemberGroupService.cs | Introduces new bulk GetAsync(IEnumerable<Guid>) with a default fallback implementation. |
| src/Umbraco.Cms.Api.Management/Mapping/Item/ItemTypeMapDefinition.cs | Adds mapper definition from IMemberGroup to MemberGroupItemResponseModel. |
| src/Umbraco.Cms.Api.Management/Factories/PublicAccessPresentationFactory.cs | Switches group resolution to IMemberGroupService and keeps obsolete ctor for compatibility. |
| src/Umbraco.Cms.Api.Management/Controllers/MemberGroup/Item/ItemMemberGroupItemController.cs | Uses IMemberGroupService.GetAsync(ids) instead of IEntityService.GetAll(...) for item hydration. |
IMemberGroupService (closes #22580)
IMemberGroupService (closes #22580)IMemberGroupService in backoffice dialog (closes #22580)
|
I think it is. If you trace through from Importantly though, this goes via |
kjac
left a comment
There was a problem hiding this comment.
In that case I'm happy with this 👍

Description
Issue #22580 describes a situation where a custom
IMemberGroupServicehas been created, and notes that the public access dialog doesn't use this.This is because of two issues:
PublicAccessPresentationFactory: reads fromIMemberRoleManager.Roles+IEntityService.GetAll(...)to get the list of roles to pick fromItemMemberGroupItemController(GET /umbraco/management/api/v1/item/member-group): usesIEntityService.GetAll(UmbracoObjectTypes.MemberGroup, ...)to get the picked items.Both of these now use
IMemberGroupServicewhere a new method allowing bulk lookup by keys has been introduced.Known gap
The member-group tree controllers under
src/Umbraco.Cms.Api.Management/Controllers/MemberGroup/Tree/still go throughIEntityServicevia the sharedNamedEntityTreeControllerBase. Rewiring that path requires a larger change to shared tree infrastructure, and would also break consistency with the shared entity service use of other trees, so hasn't been tackled here.It's likely reasonable in that if someone does have their own implementation of the member services, they aren't looking to manage members via the backoffice anyway.
Testing
Automated
New tests have been added to verify
PublicAccessPresentationFactoryandMemberGroupService.Manual
Using a custom implementation of
IMemberGroupServiceverify that the public access dialog works as expected.FixedMemberGroupService .cs