Skip to content

FIX / Restore the "include sub-groups' members" toggle - #25289

Merged
AdrienClairembault merged 5 commits into
glpi-project:11.0/bugfixesfrom
Mary-Clb:fix/group-users-subgroups-toggle
Sep 7, 2026
Merged

FIX / Restore the "include sub-groups' members" toggle#25289
AdrienClairembault merged 5 commits into
glpi-project:11.0/bugfixesfrom
Mary-Clb:fix/group-users-subgroups-toggle

Conversation

@Mary-Clb

Copy link
Copy Markdown
Contributor
  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !45960
  • When a user belongs to both a group and its sub-group, that user is shown twice (once per real membership). This is intentional, per the PR Groups UI Twig #16721 review discussion itself: each row is a genuine, distinct glpi_groups_users record, labelled by its own "Group" column. This PR does not change that behavior — clearDuplicatedGroupData() stays disabled, as decided at the time.
    However, for the sake of clarity on the end-user side, it was decided to restore a Yes/No toggle so admins can choose for themselves whether they want that aggregated, sub-groups-included view at all, rather than always having it forced on them. Care was taken to preserve any active column filter (Manager, Dynamic, Delegatee).

Screenshots :

Capture d’écran du 2026-08-27 14-09-36 Capture d’écran du 2026-08-27 14-09-47 Capture d’écran du 2026-08-27 14-10-15

@stonebuzz stonebuzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI bothers me a little.

Having the filter displayed here, especially across two lines, doesn’t feel very clean or consistent from a UI perspective.

I would suggest moving the filter to this location instead (IMHO):

Image

This would probably require adapting/improving glpi/templates/components/datatable.html.twig to support the configuration of additional filters that can be handled directly by the datatable.

It will require a bit of work, but I think it could be a worthwhile improvement, as this mechanism could potentially be reused in other contexts as well.

What do you think, @cconard96 ?

@cconard96

Copy link
Copy Markdown
Member

What do you think, @cconard96 ?

IMO The filters make more sense above or inline with the pager text ("Showing 1 to X of X rows"), but certainly not above the form to add a user to the group. I also don't really like the idea of having some filters always showing and others hidden behind a button, but datatable only supports filters directly tied to specific columns so not much we can do without redoing all of it.

At the very least, I suggest placing the filter after the "add user" form and making sure the form, recursive filter, and results are visually separated with a horizontal rule or border.

@orthagh orthagh closed this Aug 28, 2026
@orthagh orthagh reopened this Aug 28, 2026
@orthagh

orthagh commented Aug 28, 2026

Copy link
Copy Markdown
Member

close/reopen to force snyk to give details about its fail.

@Mary-Clb

Mary-Clb commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

I moved the toggle below the "add user" form, added an <hr> separator between the form and the toggle, and contrained its width so the label + select stay on a single line, right-aligned near the pager. the adresses @cconard96 minimum request without touching any shared template.

Proposed follow-up for the datable integration - @stonebuzz 's suggestion - rather than a full filter-engine rework, add a lightweight, reusable slot to templates/components/datatable.html.twigfor caller-provided filter controls, rendered in the table toolbar right after the pager:

{% if additional_filters is defined and additional_filters is not empty %} <div class="d-flex flex-wrap align-items-end justify-content-end gap-2 mb-2 border-bottom pb-2"> {{ additional_filters|raw }} </div> {% endif %}

The caller just builds the control HTML and passes in it :

TemplateRenderer::getInstance()->display('components/datatable.html.twig', [ // ... 'additional_filters' => $tree_toggle_html, ]);

This keeps the toggle visually inside the datatable, aligned with the pager and separated from the results, and the slot can be reused by any other list that needs a non-column filter. A fully structured config ({name, type, label, options}) that the datatable turns into a reloadTabcall itself is doable later but is a lot more surface for this bugfix.
Do you want the additional_filters slot in this PR ?

I ping @AdrienClairembault to have his opinion.

@Mary-Clb Mary-Clb self-assigned this Sep 1, 2026
@Mary-Clb
Mary-Clb requested a review from trasher September 1, 2026 08:27
Comment thread tests/functional/Group_UserTest.php Outdated
@Mary-Clb
Mary-Clb requested a review from trasher September 3, 2026 11:26

@trasher trasher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from a code point of view

Comment thread src/Group_User.php Outdated
@Mary-Clb
Mary-Clb marked this pull request as ready for review September 7, 2026 10:01
@AdrienClairembault
AdrienClairembault merged commit 1721b1b into glpi-project:11.0/bugfixes Sep 7, 2026
13 checks passed
@cedric-anne cedric-anne added this to the 11.0.9 milestone Sep 7, 2026
@cedric-anne cedric-anne added the bug label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants