Merge pull request #21762 from jitendrapurohit/job-alert
[civicrm-core.git] / ext / search_kit / Civi / Api4 / SearchDisplay.php
CommitLineData
e991ce44
CW
1<?php
2namespace Civi\Api4;
3
4/**
5 * SearchDisplay entity.
6 *
7 * Provided by the Search Kit extension.
8 *
aa998597 9 * @searchable none
e991ce44
CW
10 * @package Civi\Api4
11 */
12class SearchDisplay extends Generic\DAOEntity {
13
3bbce6e9 14 use Generic\Traits\ManagedEntity;
9626d0a1 15
406f1014
CW
16 /**
17 * @param bool $checkPermissions
18 * @return Action\SearchDisplay\Run
19 */
20 public static function run($checkPermissions = TRUE) {
21 return (new Action\SearchDisplay\Run(__CLASS__, __FUNCTION__))
22 ->setCheckPermissions($checkPermissions);
23 }
24
06ea32c2
CW
25 /**
26 * @param bool $checkPermissions
27 * @return Action\SearchDisplay\GetSearchTasks
28 */
29 public static function getSearchTasks($checkPermissions = TRUE) {
30 return (new Action\SearchDisplay\GetSearchTasks(__CLASS__, __FUNCTION__))
31 ->setCheckPermissions($checkPermissions);
32 }
33
e405006c
CW
34 /**
35 * @param bool $checkPermissions
ea04af0c 36 * @return Action\SearchDisplay\Download
e405006c
CW
37 */
38 public static function download($checkPermissions = TRUE) {
39 return (new Action\SearchDisplay\Download(__CLASS__, __FUNCTION__))
40 ->setCheckPermissions($checkPermissions);
41 }
42
ea04af0c
CW
43 /**
44 * @param bool $checkPermissions
45 * @return Action\SearchDisplay\GetDefault
46 */
47 public static function getDefault($checkPermissions = TRUE) {
48 return (new Action\SearchDisplay\GetDefault(__CLASS__, __FUNCTION__))
49 ->setCheckPermissions($checkPermissions);
50 }
51
faa79dbf
CW
52 public static function permissions() {
53 $permissions = parent::permissions();
9ac56a77 54 $permissions['default'] = ['administer CiviCRM data'];
dbd2175b
CW
55 // Anyone with access to CiviCRM can view search displays (but not necessarily the results)
56 $permissions['get'] = $permissions['getDefault'] = ['access CiviCRM'];
57 // Anyone with access to CiviCRM can do search tasks (but not necessarily all of them)
1c939f54 58 $permissions['getSearchTasks'] = ['access CiviCRM'];
dbd2175b
CW
59 // Permission to run or download search results is checked internally
60 $permissions['run'] = $permissions['download'] = [];
faa79dbf
CW
61 return $permissions;
62 }
63
e991ce44 64}