Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix search display access for non-admin users #21082

Merged
merged 1 commit into from
Aug 17, 2021
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
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