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