diff --git a/CHANGELOG.md b/CHANGELOG.md index aa96cbb..0f7860a 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 in 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..7cac026 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->getFromDB($tickets_id) || !$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..cfd9ad4 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->getFromDB($tickets_id) || !$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'];