This is not a bug. Resolving nesting downwards from the group produces exactly the same result as resolving nesting upwards from the user.
The performance implication specific to Confluence arises because of the way caching is implemented at the DAO level. If you cache the direct subgroups of a group, this will take care of the performance issue. Caching a collection of subgroup references/names should not consume a large amount of memory.
I think in Crowd though, we should change:
List<Group> subGroups = searchDirectGroupRelationships(directoryId, QueryBuilder.queryFor(Group.class, EntityDescriptor.group()).childrenOf(EntityDescriptor.group()).withName(groupName).returningAtMost(EntityQuery.ALL_RESULTS));
To return List<String> to facilitate name caching.
Thoughts?
Raised CWD-2465 to cover improving support for name caching of memberships.
Leaving this as is, so you can decide whether to call findNestedGroupMembershipsOfUser inside isUserNestedGroupMember if/when the former is known to perform well.