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