8000
Skip to content

Fix - Linked ITIL objects visibility across entities and rights verification - #22851

Merged
cedric-anne merged 18 commits into
glpi-project:11.0/bugfixesfrom
RomainLvr:fix/linked-itil-objects-cross-entity-visibility
Feb 5, 2026
Merged

Fix - Linked ITIL objects visibility across entities and rights verification#22851
cedric-anne merged 18 commits into
glpi-project:11.0/bugfixesfrom
RomainLvr:fix/linked-itil-objects-cross-entity-visibility

Conversation

@RomainLvr
@RomainLvr RomainLvr commented Jan 27, 2026
Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • 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 !41711
  • Here is a brief description of what this PR does

Fixes an issue where users could not link tickets between parent/child entities from the root entity, and could see titles of tickets they don't have access to in the linked objects panel.

Issues addressed

  1. Self-linking possible: Users could link a ticket to itself, causing an "Unknown ITIL object" error.

  2. Duplicate links possible: Users could select items already linked in the dropdown, leading to duplicate link attempts.

  3. Incomplete Change/Problem handling in Dropdown: The Dropdown.php was missing rights restriction handling for Change and Problem itemtypes (only Ticket was handled).

  4. Missing visual distinction for inaccessible items: Linked items were displayed with clickable links even when the user cannot access them.

Changes

  • CommonITILObject_CommonITILObject.php: Added self-link prevention in prepareInputForAdd() - an item cannot be linked to itself.

  • Dropdown.php: Mutualized Ticket, Change, and Problem cases into a single block with proper rights restrictions using Search::addDefaultJoin/addDefaultWhere.

  • linked_itilobjects.html.twig:

    • Removed entity_restrict (uses default behavior respecting entity visibility as discussed in fix(itil): Linked itilobject should return the child entities itilobject #21680)
    • Added used parameter to exclude current item AND already linked items from dropdown
    • Added canViewItem() check: items the user can access are display 8000 ed as clickable links, others are displayed as muted text without link

Tests added

  • testPreventSelfLink: Tests that tickets, changes, and problems cannot be linked to themselves.

@RomainLvr RomainLvr self-assigned this Jan 27, 2026
@RomainLvr
RomainLvr requested review from Rom1-B and stonebuzz January 27, 2026 13:37
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
@cedric-anne
Copy link
Copy Markdown
Member

Missing rights verification: Linked items were displayed without checking if the current user has read access to them, exposing ticket titles to unauthorized users.

This is a common behaviour in GLPI. When a user does not have enough rights to see the linked item, most of the time, the name of this item is displayed instead of a link.

Comment thread src/Dropdown.php
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
@cedric-anne cedric-anne added this to the 11.0.6 milestone Jan 28, 2026
@RomainLvr
RomainLvr requested a review from cedric-anne January 28, 2026 15:33
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig
@RomainLvr
RomainLvr force-pushed the fix/linked-itil-objects-cross-entity-visibility branch from 7d0af3c to 2db6081 Compare January 29, 2026 08:37
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
RomainLvr and others added 2 commits January 29, 2026 09:47
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
@cedric-anne cedric-anne left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As discussed IRL, the entity restriction has been introduced by #10989 and should be reverted.

@RomainLvr
RomainLvr requested a review from cedric-anne February 2, 2026 10:43
@cedric-anne cedric-anne left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The getAllLinkedTo() method is used during notification generation, with a session context that, most of the time, does not correspond to the notification target user. It means that the filtering cannot be done using the session.

Anyway, as notification data is shared accross all users, I have no idea how we could make it compatible with the fact we want to relations out of the current entity scope in the UI.

Comment thread src/CommonITILObject_CommonITILObject.php Outdated
Comment thread src/CommonITILObject_CommonITILObject.php Outdated
RomainLvr and others added 3 commits February 2, 2026 13:35
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
@froozeify froozeify linked an issue Feb 4, 2026 that may be closed by this pull request
2 tasks
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
Comment thread templates/components/itilobject/linked_itilobjects.html.twig Outdated
RomainLvr and others added 3 commits February 5, 2026 12:11
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
@cedric-anne
cedric-anne merged commit 815e2a9 into glpi-project:11.0/bugfixes Feb 5, 2026
9 checks passed
SebSept pushed a commit to SebSept/glpi that referenced this pull request Feb 19, 2026
SebSept pushed a commit to SebSept/glpi that referenced this pull request Mar 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR has been is closed and has been automatically locked. Please open a new issue with all requested information for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with adding Linked assistance object ( ticket )

4 participants

0