Skip to content

Commit

Permalink
fix(helpdesk): better handling of users that can't see tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault authored and btry committed Jan 4, 2023
1 parent 8f36ab7 commit a93f031
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
10 changes: 8 additions & 2 deletions ajax/formanswer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

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

if (plugin_formcreator_replaceHelpdesk()) {
if (Ticket::canView()) {
$redirect = PluginFormcreatorIssue::getSearchURL();
} else {
$redirect = 'wizard.php';
}

// Form was saved from the service catalog
echo json_encode(
[
'redirect' => PluginFormcreatorIssue::getSearchURL(),
'redirect' => $redirect,
], JSON_FORCE_OBJECT
);
die();
Expand Down
26 changes: 14 additions & 12 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,20 +783,22 @@ public static function hookRedefineMenu($menus) {
'title' => __('Seek assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-headset',
];
$newMenu['my_assistance_requests'] = [
'default' => PluginFormcreatorIssue::getSearchURL(false),
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'content' => [
PluginFormcreatorIssue::class => [
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'links' => [
'lists' => '',
if (Ticket::canView()) {
$newMenu['my_assistance_requests'] = [
'default' => PluginFormcreatorIssue::getSearchURL(false),
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'content' => [
PluginFormcreatorIssue::class => [
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'links' => [
'lists' => '',
],
],
],
],
];
];
}

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

0 comments on commit a93f031

Please sign in to comment.