Skip to content
Open
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,19 @@
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 Session;
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
15 changes: 15 additions & 0 deletions src/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,21 @@ public function canCreateItem(): bool
return parent::canCreateItem();
}

/**
* Check if user can view saved searches
* Allow access in helpdesk interface for private searches
*/
public static function canView(): bool
{
// Allow access in helpdesk interface (private searches only)
if (Session::getCurrentInterface() === 'helpdesk') {
return true;
}

// Standard check for central interface
return Session::haveRight(static::$rightname, READ);
}

public function canViewItem(): bool
{
if ($this->fields['is_private'] == 1) {
Expand Down
Loading