Skip to content

show approvals in read-only mode when Object Lock is enabled#23477

Open
f2cmb wants to merge 3 commits intoglpi-project:11.0/bugfixesfrom
f2cmb:11.0/23455
Open

show approvals in read-only mode when Object Lock is enabled#23477
f2cmb wants to merge 3 commits intoglpi-project:11.0/bugfixesfrom
f2cmb:11.0/23455

Conversation

@f2cmb
Copy link
Contributor

@f2cmb f2cmb commented Mar 13, 2026

  • 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

Ticket/Change approvals were hidden when viewing items in read-only mode (Object Lock enabled) because CommonITILValidation::canView() required write-level rights (CREATE/VALIDATE/PURGE) which get stripped by the lock profile.

Adds READ to the validation rights model so viewing approvals no longer requires write permissions.

@f2cmb
Copy link
Contributor Author

f2cmb commented Mar 16, 2026

Manual backoffice testing confirmed the fix across 5 scenarios :

  • approvals are visible in read-only mode without Object Lock engaged,
  • approvals remain visible when the ticket is locked by another user,
  • the Read-Only profile can see approvals but has no action buttons,
  • Change approvals behave identically to Ticket approvals
  • a profile with no validation rights correctly hides approvals from both the tab and the timeline.

This validates that the READ right addition resolves the original issue where approvals were hidden in read-only contexts, while preserving proper access control for unprivileged profiles.

@f2cmb f2cmb marked this pull request as ready for review March 16, 2026 14:59
// making it impossible to view validations in read-only contexts (e.g. Object Lock mode).
foreach (['ticketvalidation', 'changevalidation'] as $right_name) {
$DB->update(
'glpi_profilerights',
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually, we do not change existing "configuration" on update. There is no reliable way to know if it's not been changed, or set on purpose.

Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

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

This change is too important for a bugfixes version. Maybe it could be valid for the main branch, but before doing rights management changes, you should validate that @orthagh is OK with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ticket Approvals are not shown when ticket is not locked

3 participants