Skip to content

Commit a93f031

Browse files
AdrienClairembaultbtry
authored andcommitted
fix(helpdesk): better handling of users that can't see tickets
1 parent 8f36ab7 commit a93f031

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

ajax/formanswer.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
}
8989

9090
// redirect to created item
91-
if ($_SESSION['glpibackcreated']) {
91+
if ($_SESSION['glpibackcreated'] && Ticket::canView()) {
9292
if (strpos($_SERVER['HTTP_REFERER'], 'form.form.php') === false) {
9393
// User was not testing the form from preview
9494
if (count($formAnswer->targetList) == 1) {
@@ -116,10 +116,16 @@
116116
}
117117

118118
if (plugin_formcreator_replaceHelpdesk()) {
119+
if (Ticket::canView()) {
120+
$redirect = PluginFormcreatorIssue::getSearchURL();
121+
} else {
122+
$redirect = 'wizard.php';
123+
}
124+
119125
// Form was saved from the service catalog
120126
echo json_encode(
121127
[
122-
'redirect' => PluginFormcreatorIssue::getSearchURL(),
128+
'redirect' => $redirect,
123129
], JSON_FORCE_OBJECT
124130
);
125131
die();

inc/common.class.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -783,20 +783,22 @@ public static function hookRedefineMenu($menus) {
783783
'title' => __('Seek assistance', 'formcreator'),
784784
'icon' => 'fa-fw ti ti-headset',
785785
];
786-
$newMenu['my_assistance_requests'] = [
787-
'default' => PluginFormcreatorIssue::getSearchURL(false),
788-
'title' => __('My requests for assistance', 'formcreator'),
789-
'icon' => 'fa-fw ti ti-list',
790-
'content' => [
791-
PluginFormcreatorIssue::class => [
792-
'title' => __('My requests for assistance', 'formcreator'),
793-
'icon' => 'fa-fw ti ti-list',
794-
'links' => [
795-
'lists' => '',
786+
if (Ticket::canView()) {
787+
$newMenu['my_assistance_requests'] = [
788+
'default' => PluginFormcreatorIssue::getSearchURL(false),
789+
'title' => __('My requests for assistance', 'formcreator'),
790+
'icon' => 'fa-fw ti ti-list',
791+
'content' => [
792+
PluginFormcreatorIssue::class => [
793+
'title' => __('My requests for assistance', 'formcreator'),
794+
'icon' => 'fa-fw ti ti-list',
795+
'links' => [
796+
'lists' => '',
797+
],
796798
],
797799
],
798-
],
799-
];
800+
];
801+
}
800802

801803
if (PluginFormcreatorEntityConfig::getUsedConfig('is_kb_separated', Session::getActiveEntity()) == PluginFormcreatorEntityConfig::CONFIG_KB_DISTINCT
802804
&& Session::haveRight('knowbase', KnowbaseItem::READFAQ)

0 commit comments

Comments
 (0)