SearchKit - Change @searchable annotation from boolean to option list
[civicrm-core.git] / Civi / Api4 / Permission.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 */
18
19 namespace Civi\Api4;
20
21 /**
22 * (Read-only) Available permissions
23 *
24 * NOTE: This is a high-level API intended for introspective use by administrative tools.
25 * It may be poorly suited to recursive usage (e.g. permissions defined dynamically
26 * on top of permissions!) or during install/uninstall processes.
27 *
28 * @searchable none
29 * @package Civi\Api4
30 */
31 class Permission extends Generic\AbstractEntity {
32
33 /**
34 * @param bool $checkPermissions
35 * @return Action\Permission\Get
36 */
37 public static function get($checkPermissions = TRUE) {
38 return (new Action\Permission\Get(__CLASS__, __FUNCTION__))
39 ->setCheckPermissions($checkPermissions);
40 }
41
42 /**
43 * @param bool $checkPermissions
44 * @return Generic\BasicGetFieldsAction
45 */
46 public static function getFields($checkPermissions = TRUE) {
47 return (new Generic\BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() {
48 return [
49 [
50 'name' => 'group',
51 'title' => 'Group',
52 'data_type' => 'String',
53 ],
54 [
55 'name' => 'name',
56 'title' => 'Name',
57 'data_type' => 'String',
58 ],
59 [
60 'name' => 'title',
61 'title' => 'Title',
62 'data_type' => 'String',
63 ],
64 [
65 'name' => 'description',
66 'title' => 'Description',
67 'data_type' => 'String',
68 ],
69 [
70 'name' => 'is_synthetic',
71 'title' => 'Is Synthetic',
72 'data_type' => 'Boolean',
73 ],
74 [
75 'name' => 'is_active',
76 'title' => 'Is Active',
77 'description' => '',
78 'default' => TRUE,
79 'data_type' => 'Boolean',
80 ],
81 ];
82 }))->setCheckPermissions($checkPermissions);
83 }
84
85 /**
86 * @return array
87 */
88 public static function permissions() {
89 return [
90 "meta" => ["access CiviCRM"],
91 "default" => ["access CiviCRM"],
92 ];
93 }
94
95 }