From f0569a8382eb22b2f1c1cc223557a67d905dfa40 Mon Sep 17 00:00:00 2001 From: Lainow Date: Tue, 24 Sep 2024 12:04:53 +0200 Subject: [PATCH 1/7] Fix ticket read no right message --- front/ticket.form.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index c144c55..f0075aa 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -32,6 +32,7 @@ include('../../../inc/includes.php'); +$track = new Ticket(); if (isset($_POST['escalate'])) { $group_id = (int)$_POST['groups_id']; $tickets_id = (int)$_POST['tickets_id']; @@ -88,4 +89,17 @@ } } -Html::back(); +if ($track->can($_POST["tickets_id"], READ)) { + $toadd = ''; + // Copy solution to KB redirect to KB + if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) { + $toadd = "&_sol_to_kb=1"; + } + Html::redirect(Ticket::getFormURLWithID($_POST["tickets_id"]) . $toadd); +} +Session::addMessageAfterRedirect( + __('You have been redirected because you no longer have access to this ticket'), + true, + ERROR +); +Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.php"); From e1dfd1468961cfb5109e3bc70f26f0ffd6a9d382 Mon Sep 17 00:00:00 2001 From: Lainow Date: Wed, 25 Sep 2024 10:31:30 +0200 Subject: [PATCH 2/7] Add suggestions --- front/ticket.form.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index f0075aa..c01eeb6 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -89,14 +89,6 @@ } } -if ($track->can($_POST["tickets_id"], READ)) { - $toadd = ''; - // Copy solution to KB redirect to KB - if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) { - $toadd = "&_sol_to_kb=1"; - } - Html::redirect(Ticket::getFormURLWithID($_POST["tickets_id"]) . $toadd); -} Session::addMessageAfterRedirect( __('You have been redirected because you no longer have access to this ticket'), true, From 6fda9f95a2d1c6836869656e513e54dcf7887f28 Mon Sep 17 00:00:00 2001 From: Lainow Date: Wed, 25 Sep 2024 10:32:35 +0200 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e8f1f..a5f0617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unrelease] - +### Fixed + +- Correction of the read no right message ticket and redirection + ## [2.9.9] - 2024-09-10 ### Fixed From 14392b5cd5bc91f7771d608c7487702a2ca3b871 Mon Sep 17 00:00:00 2001 From: LAUNAY Samuel <107540223+Lainow@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:47:15 +0200 Subject: [PATCH 4/7] Update CHANGELOG.md Co-authored-by: Stanislas --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5f0617..44873fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- Correction of the read no right message ticket and redirection +- Redirect user after escalation if he has no rights to the ticket ## [2.9.9] - 2024-09-10 From 48dde92e2680b5a3528d47f231fff2ffc005cb33 Mon Sep 17 00:00:00 2001 From: Lainow Date: Wed, 25 Sep 2024 12:17:26 +0200 Subject: [PATCH 5/7] Remove useless var --- front/ticket.form.php | 1 - 1 file changed, 1 deletion(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index c01eeb6..df5e0a9 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -32,7 +32,6 @@ include('../../../inc/includes.php'); -$track = new Ticket(); if (isset($_POST['escalate'])) { $group_id = (int)$_POST['groups_id']; $tickets_id = (int)$_POST['tickets_id']; From 361bfa1e5057de1fc99deb60c8ff5379770b0398 Mon Sep 17 00:00:00 2001 From: Lainow Date: Wed, 25 Sep 2024 17:00:40 +0200 Subject: [PATCH 6/7] Apply suggestions --- front/ticket.form.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/front/ticket.form.php b/front/ticket.form.php index df5e0a9..79f7eef 100644 --- a/front/ticket.form.php +++ b/front/ticket.form.php @@ -86,11 +86,15 @@ ) . $_POST['comment'] ]); } + + if (!$track->can($_POST["tickets_id"], READ)) { + Session::addMessageAfterRedirect( + __('You have been redirected because you no longer have access to this ticket'), + true, + ERROR + ); + Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.php"); + } } -Session::addMessageAfterRedirect( - __('You have been redirected because you no longer have access to this ticket'), - true, - ERROR -); -Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.php"); +Html::back(); From b1aff5e292f8f171598910a6fe7b5e49249b0290 Mon Sep 17 00:00:00 2001 From: LAUNAY Samuel <107540223+Lainow@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:37:33 +0100 Subject: [PATCH 7/7] Update CHANGELOG.md Co-authored-by: Stanislas --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1769308..968b596 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- Redirect user after escalation if he has no rights to the ticket +- Redirect users without ticket rights after escalation. ## [2.9.10] - 2024-11-27