From 61960032b7bc065ebacfc101170e8d8f0afb5ddd Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Thu, 30 Jul 2026 12:10:33 +0200 Subject: [PATCH 1/4] fix(escalade): Fix errors in rights checks during escalation --- CHANGELOG.md | 6 ++++++ ajax/assign_me.php | 44 ------------------------------------------- front/climb_group.php | 5 ++++- front/ticket.form.php | 6 +++++- inc/ticket.class.php | 23 ---------------------- 5 files changed, 15 insertions(+), 69 deletions(-) delete mode 100644 ajax/assign_me.php diff --git a/CHANGELOG.md b/CHANGELOG.md index aa96cbb..e273079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Fix errors rights checks during escalation + ## [2.10.5] - 2026-07-28 ### Fixed diff --git a/ajax/assign_me.php b/ajax/assign_me.php deleted file mode 100644 index 59f5fea..0000000 --- a/ajax/assign_me.php +++ /dev/null @@ -1,44 +0,0 @@ -. - * ------------------------------------------------------------------------- - * @copyright Copyright (C) 2015-2023 by Escalade plugin team. - * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html - * @link https://github.com/pluginsGLPI/escalade - * ------------------------------------------------------------------------- - */ - -use Glpi\Exception\Http\BadRequestHttpException; - -Session::checkLoginUser(); - -if (! isset($_REQUEST['tickets_id'])) { - throw new BadRequestHttpException(); -} - -$tickets_id = (int) $_REQUEST['tickets_id']; - -$ticket = new Ticket(); -$ticket->check($tickets_id, Ticket::ASSIGN); - -PluginEscaladeTicket::assign_me($tickets_id); diff --git a/front/climb_group.php b/front/climb_group.php index 6ba2fc6..b5fa219 100644 --- a/front/climb_group.php +++ b/front/climb_group.php @@ -29,6 +29,7 @@ */ use Glpi\Exception\Http\BadRequestHttpException; +use Glpi\Exception\Http\AccessDeniedHttpException; Session::checkLoginUser(); @@ -47,6 +48,8 @@ $tickets_id = (int) $_REQUEST['tickets_id']; $ticket = new Ticket(); -$ticket->check($tickets_id, Ticket::ASSIGN); +if (!$ticket->canAssign()) { + throw new AccessDeniedHttpException(); +} PluginEscaladeTicket::climb_group($tickets_id, (int) $_REQUEST['groups_id']); diff --git a/front/ticket.form.php b/front/ticket.form.php index 42afcb5..a6e036e 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -28,6 +28,8 @@ * ------------------------------------------------------------------------- */ +use Glpi\Exception\Http\AccessDeniedHttpException; + Session::checkLoginUser(); /** @var array $CFG_GLPI */ @@ -38,7 +40,9 @@ $tickets_id = (int) $_POST['tickets_id']; $ticket = new Ticket(); - $ticket->check($tickets_id, Ticket::ASSIGN); + if (!$ticket->canAssign()) { + throw new AccessDeniedHttpException(); + } PluginEscaladeTicket::timelineClimbAction($group_id, $tickets_id, $_POST); diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 0b9beb0..b39f5bc 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -1102,29 +1102,6 @@ public static function cloneAndLink($tickets_id) echo sprintf('{"success":true, "newID":%s}', $newID); } - - public static function assign_me($tickets_id) - { - - $tu = new Ticket_User(); - $found = $tu->find([ - 'tickets_id' => $tickets_id, - 'users_id' => $_SESSION['glpiID'], - 'type' => CommonITILActor::ASSIGN, - ]); - - if (empty($found)) { - $ticket = new Ticket(); - $ticket->update([ - 'id' => $tickets_id, - '_itil_assign' => [ - 'users_id' => $_SESSION['glpiID'], - '_type' => 'user', - ], - ]); - } - } - public static function filter_actors(array $params = []): array { $itemtype = $params['params']['itemtype']; From 3693de17e7b608e5b4cd4e277f78a52fd593238d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Langlois=20Ga=C3=ABtan?= <64356364+MyvTsv@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:35:03 +0200 Subject: [PATCH 2/4] Update front/climb_group.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- front/climb_group.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/climb_group.php b/front/climb_group.php index b5fa219..7cac026 100644 --- a/front/climb_group.php +++ b/front/climb_group.php @@ -48,7 +48,7 @@ $tickets_id = (int) $_REQUEST['tickets_id']; $ticket = new Ticket(); -if (!$ticket->canAssign()) { +if (!$ticket->getFromDB($tickets_id) || !$ticket->canAssign()) { throw new AccessDeniedHttpException(); } From 88a861cba14da78ecc28a6310e0b9ada3c989e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Langlois=20Ga=C3=ABtan?= <64356364+MyvTsv@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:35:11 +0200 Subject: [PATCH 3/4] Update front/ticket.form.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- front/ticket.form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index a6e036e..cfd9ad4 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -40,7 +40,7 @@ $tickets_id = (int) $_POST['tickets_id']; $ticket = new Ticket(); - if (!$ticket->canAssign()) { + if (!$ticket->getFromDB($tickets_id) || !$ticket->canAssign()) { throw new AccessDeniedHttpException(); } From be12ef58c2042d315951c59be60ab7e4af8f4c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Langlois=20Ga=C3=ABtan?= <64356364+MyvTsv@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:35:18 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e273079..0f7860a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- Fix errors rights checks during escalation +- Fix errors in rights checks during escalation ## [2.10.5] - 2026-07-28