Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@
namespace Glpi\Controller\ItemType\Form;

use Glpi\Controller\GenericFormController;
use Glpi\Http\Firewall;
use Glpi\Http\RedirectResponse;
use Glpi\Routing\Attribute\ItemtypeFormRoute;
use Glpi\Security\Attribute\SecurityStrategy;
use Html;
use SavedSearch;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class SavedSearchFormController extends GenericFormController
{
#[SecurityStrategy(Firewall::STRATEGY_AUTHENTICATED)]
#[ItemtypeFormRoute(SavedSearch::class)]
public function __invoke(Request $request): Response
{
Expand Down
17 changes: 17 additions & 0 deletions src/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ public function canCreateItem(): bool
return parent::canCreateItem();
}

public static function canView(): bool
{
// Always allow access, as user should always be able to see its private searches.
return true;
}

public function canViewItem(): bool
{
if ($this->fields['is_private'] == 1) {
Expand Down Expand Up @@ -1227,6 +1233,17 @@ public static function getIcon()
return "ti ti-bookmarks";
}

public static function getPostFormAction(string $form_action, bool $action_success): ?string
{
// For simplified interface users, always redirect back to the search page
if ($form_action === 'add' && $action_success && Session::getCurrentInterface() === 'helpdesk') {
return 'back';
}

// Use parent behavior for all other cases
return parent::getPostFormAction($form_action, $action_success);
}

public function getCloneRelations(): array
{
return [];
Expand Down
Loading