Skip to content

Commit

Permalink
Merge pull request #21082 from colemanw/fixSearchKitPermissions
Browse files Browse the repository at this point in the history
Fix search display access for non-admin users
  • Loading branch information
eileenmcnaughton authored Aug 17, 2021
2 parents 613f5b0 + 144025a commit 88056dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Civi/Api4/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
*/
class SavedSearch extends Generic\DAOEntity {

public static function permissions() {
$permissions = parent::permissions();
$permissions['get'] = ['access CiviCRM'];
return $permissions;
}

}
1 change: 1 addition & 0 deletions ext/search_kit/Civi/Api4/SearchDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static function getSearchTasks($checkPermissions = TRUE) {
public static function permissions() {
$permissions = parent::permissions();
$permissions['default'] = ['administer CiviCRM data'];
$permissions['get'] = ['access CiviCRM'];
$permissions['getSearchTasks'] = ['access CiviCRM'];
// Permission for run action is checked internally
$permissions['run'] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public function testWithACLBypass() {
}
$this->assertStringContainsString('failed', $error);

$config->userPermissionClass->permissions = ['administer CiviCRM data'];
$config->userPermissionClass->permissions = ['access CiviCRM', 'administer CiviCRM data'];

// Admins can edit the search and the display
SavedSearch::update()->addWhere('name', '=', $searchName)
Expand Down

0 comments on commit 88056dc

Please sign in to comment.