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 |
29541977 TO |
21 | * @package Civi\Api4 |
22 | */ | |
23 | class Permission extends Generic\AbstractEntity { | |
24 | ||
25 | /** | |
26 | * @param bool $checkPermissions | |
f48d7e65 | 27 | * @return Action\Permission\Get |
29541977 TO |
28 | */ |
29 | public static function get($checkPermissions = TRUE) { | |
f48d7e65 CW |
30 | return (new Action\Permission\Get(__CLASS__, __FUNCTION__)) |
31 | ->setCheckPermissions($checkPermissions); | |
29541977 TO |
32 | } |
33 | ||
34 | /** | |
35 | * @param bool $checkPermissions | |
36 | * @return Generic\BasicGetFieldsAction | |
37 | */ | |
38 | public static function getFields($checkPermissions = TRUE) { | |
39 | return (new Generic\BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { | |
40 | return [ | |
41 | [ | |
42 | 'name' => 'group', | |
43 | 'title' => 'Group', | |
29541977 TO |
44 | 'data_type' => 'String', |
45 | ], | |
46 | [ | |
47 | 'name' => 'name', | |
48 | 'title' => 'Name', | |
29541977 TO |
49 | 'data_type' => 'String', |
50 | ], | |
51 | [ | |
52 | 'name' => 'title', | |
53 | 'title' => 'Title', | |
29541977 TO |
54 | 'data_type' => 'String', |
55 | ], | |
56 | [ | |
57 | 'name' => 'description', | |
58 | 'title' => 'Description', | |
29541977 TO |
59 | 'data_type' => 'String', |
60 | ], | |
61 | [ | |
62 | 'name' => 'is_synthetic', | |
63 | 'title' => 'Is Synthetic', | |
29541977 TO |
64 | 'data_type' => 'Boolean', |
65 | ], | |
66 | [ | |
67 | 'name' => 'is_active', | |
68 | 'title' => 'Is Active', | |
69 | 'description' => '', | |
70 | 'default' => TRUE, | |
29541977 TO |
71 | 'data_type' => 'Boolean', |
72 | ], | |
73 | ]; | |
74 | }))->setCheckPermissions($checkPermissions); | |
75 | } | |
76 | ||
77 | /** | |
78 | * @return array | |
79 | */ | |
80 | public static function permissions() { | |
81 | return [ | |
82 | "meta" => ["access CiviCRM"], | |
83 | "default" => ["access CiviCRM"], | |
84 | ]; | |
85 | } | |
86 | ||
87 | } |