Skip to content
Snippets Groups Projects
Commit f50ef72f authored by aydreeihn's avatar aydreeihn
Browse files

Search All Tickets Setting

If an Agent has the Miscellaneous setting checked to see all Tickets in search results, they should be able to see the list of Tickets regardless of their access or if the search is saved or not. They should NOT, however, be able to view those Tickets.
parent c5da1cda
No related branches found
No related tags found
No related merge requests found
...@@ -937,10 +937,14 @@ class CustomQueue extends VerySimpleModel { ...@@ -937,10 +937,14 @@ class CustomQueue extends VerySimpleModel {
return $agent && $this->isPrivate() && $this->checkOwnership($agent); return $agent && $this->isPrivate() && $this->checkOwnership($agent);
} }
function isSaved() {
return true;
}
function ignoreVisibilityConstraints(Staff $agent) { function ignoreVisibilityConstraints(Staff $agent) {
// For saved searches (not queues), some staff can have a permission to // For searches (not queues), some staff can have a permission to
// see all records // see all records
return (!$this->isASubQueue() return ($this->isASearch()
&& $this->isOwner($agent) && $this->isOwner($agent)
&& $agent->canSearchEverything()); && $agent->canSearchEverything());
} }
...@@ -994,6 +998,10 @@ class CustomQueue extends VerySimpleModel { ...@@ -994,6 +998,10 @@ class CustomQueue extends VerySimpleModel {
return $this->hasFlag(self::FLAG_QUEUE); return $this->hasFlag(self::FLAG_QUEUE);
} }
function isASearch() {
return !$this->isAQueue() || !$this->isSaved();
}
function isPrivate() { function isPrivate() {
return !$this->isAQueue() && !$this->isPublic() && return !$this->isAQueue() && !$this->isPublic() &&
$this->staff_id; $this->staff_id;
......
...@@ -912,6 +912,10 @@ extends SavedSearch { ...@@ -912,6 +912,10 @@ extends SavedSearch {
return false; return false;
} }
function isOwner(Staff $staff) {
return $this->ht['staff_id'] == $staff->getId();
}
function checkAccess($staff) { function checkAccess($staff) {
return true; return true;
} }
...@@ -921,6 +925,7 @@ extends SavedSearch { ...@@ -921,6 +925,7 @@ extends SavedSearch {
} }
function load($key) { function load($key) {
global $thisstaff;
if (strpos($key, 'adhoc') === 0) if (strpos($key, 'adhoc') === 0)
list(, $key) = explode(',', $key, 2); list(, $key) = explode(',', $key, 2);
...@@ -933,6 +938,7 @@ extends SavedSearch { ...@@ -933,6 +938,7 @@ extends SavedSearch {
$queue = new AdhocSearch(array( $queue = new AdhocSearch(array(
'id' => "adhoc,$key", 'id' => "adhoc,$key",
'root' => 'T', 'root' => 'T',
'staff_id' => $thisstaff->getId(),
'title' => __('Advanced Search'), 'title' => __('Advanced Search'),
)); ));
$queue->config = $config; $queue->config = $config;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment