1 | <?php |
||
2 | |||
3 | namespace Jabe\Authorization; |
||
4 | |||
5 | /** |
||
6 | * The set of built-in Permissions for Resources::PROCESS_DEFINITION. |
||
7 | */ |
||
8 | class ProcessDefinitionPermissions implements PermissionInterface |
||
9 | { |
||
10 | use PermissionTrait; |
||
11 | |||
12 | private static $NONE; |
||
13 | |||
14 | public static function none(): PermissionInterface |
||
15 | { |
||
16 | if (self::$NONE === null) { |
||
17 | self::$NONE = new ProcessDefinitionPermissions("NONE", 0); |
||
18 | } |
||
19 | return self::$NONE; |
||
20 | } |
||
21 | |||
22 | private static $ALL; |
||
23 | |||
24 | public static function all(): PermissionInterface |
||
25 | { |
||
26 | if (self::$ALL === null) { |
||
27 | self::$ALL = new ProcessDefinitionPermissions("ALL", PHP_INT_MAX); |
||
28 | } |
||
29 | return self::$ALL; |
||
30 | } |
||
31 | |||
32 | private static $READ; |
||
33 | |||
34 | public static function read(): PermissionInterface |
||
35 | { |
||
36 | if (self::$READ === null) { |
||
37 | self::$READ = new ProcessDefinitionPermissions("READ", 2); |
||
38 | } |
||
39 | return self::$READ; |
||
40 | } |
||
41 | |||
42 | private static $UPDATE; |
||
43 | |||
44 | public static function update(): PermissionInterface |
||
45 | { |
||
46 | if (self::$UPDATE === null) { |
||
47 | self::$UPDATE = new ProcessDefinitionPermissions("UPDATE", 4); |
||
48 | } |
||
49 | return self::$UPDATE; |
||
50 | } |
||
51 | |||
52 | private static $DELETE; |
||
53 | |||
54 | public static function delete(): PermissionInterface |
||
55 | { |
||
56 | if (self::$DELETE === null) { |
||
57 | self::$DELETE = new ProcessDefinitionPermissions("DELETE", 16); |
||
58 | } |
||
59 | return self::$DELETE; |
||
60 | } |
||
61 | |||
62 | private static $RETRY_JOB; |
||
63 | |||
64 | public static function retryJob(): PermissionInterface |
||
65 | { |
||
66 | if (self::$RETRY_JOB === null) { |
||
67 | self::$RETRY_JOB = new ProcessDefinitionPermissions("RETRY_JOB", 32); |
||
68 | } |
||
69 | return self::$RETRY_JOB; |
||
70 | } |
||
71 | |||
72 | private static $READ_TASK; |
||
73 | |||
74 | public static function readTask(): PermissionInterface |
||
75 | { |
||
76 | if (self::$READ_TASK === null) { |
||
77 | self::$READ_TASK = new ProcessDefinitionPermissions("READ_TASK", 64); |
||
78 | } |
||
79 | return self::$READ_TASK; |
||
80 | } |
||
81 | |||
82 | private static $UPDATE_TASK; |
||
83 | |||
84 | public static function updateTask(): PermissionInterface |
||
85 | { |
||
86 | if (self::$UPDATE_TASK === null) { |
||
87 | self::$UPDATE_TASK = new ProcessDefinitionPermissions("UPDATE_TASK", 128); |
||
88 | } |
||
89 | return self::$UPDATE_TASK; |
||
90 | } |
||
91 | |||
92 | private static $CREATE_INSTANCE; |
||
93 | |||
94 | public static function createInstance(): PermissionInterface |
||
95 | { |
||
96 | if (self::$CREATE_INSTANCE === null) { |
||
97 | self::$CREATE_INSTANCE = new ProcessDefinitionPermissions("CREATE_INSTANCE", 256); |
||
98 | } |
||
99 | return self::$CREATE_INSTANCE; |
||
100 | } |
||
101 | |||
102 | private static $READ_INSTANCE; |
||
103 | |||
104 | public static function readInstance(): PermissionInterface |
||
105 | { |
||
106 | if (self::$READ_INSTANCE === null) { |
||
107 | self::$READ_INSTANCE = new ProcessDefinitionPermissions("READ_INSTANCE", 512); |
||
108 | } |
||
109 | return self::$READ_INSTANCE; |
||
110 | } |
||
111 | |||
112 | private static $UPDATE_INSTANCE; |
||
113 | |||
114 | public static function updateInstance(): PermissionInterface |
||
115 | { |
||
116 | if (self::$UPDATE_INSTANCE === null) { |
||
117 | self::$UPDATE_INSTANCE = new ProcessDefinitionPermissions("UPDATE_INSTANCE", 1024); |
||
118 | } |
||
119 | return self::$UPDATE_INSTANCE; |
||
120 | } |
||
121 | |||
122 | private static $DELETE_INSTANCE; |
||
123 | |||
124 | public static function deleteInstance(): PermissionInterface |
||
125 | { |
||
126 | if (self::$DELETE_INSTANCE === null) { |
||
127 | self::$DELETE_INSTANCE = new ProcessDefinitionPermissions("DELETE_INSTANCE", 2048); |
||
128 | } |
||
129 | return self::$DELETE_INSTANCE; |
||
130 | } |
||
131 | |||
132 | private static $READ_HISTORY; |
||
133 | |||
134 | public static function readHistory(): PermissionInterface |
||
135 | { |
||
136 | if (self::$READ_HISTORY === null) { |
||
137 | self::$READ_HISTORY = new ProcessDefinitionPermissions("READ_HISTORY", 4096); |
||
138 | } |
||
139 | return self::$READ_HISTORY; |
||
140 | } |
||
141 | |||
142 | private static $DELETE_HISTORY; |
||
143 | |||
144 | public static function deleteHistory(): PermissionInterface |
||
145 | { |
||
146 | if (self::$DELETE_HISTORY === null) { |
||
147 | self::$DELETE_HISTORY = new ProcessDefinitionPermissions("DELETE_HISTORY", 8192); |
||
148 | } |
||
149 | return self::$DELETE_HISTORY; |
||
150 | } |
||
151 | |||
152 | private static $TASK_WORK; |
||
153 | |||
154 | public static function taskWork(): PermissionInterface |
||
155 | { |
||
156 | if (self::$TASK_WORK === null) { |
||
157 | self::$TASK_WORK = new ProcessDefinitionPermissions("TASK_WORK", 16384); |
||
158 | } |
||
159 | return self::$TASK_WORK; |
||
160 | } |
||
161 | |||
162 | private static $TASK_ASSIGN; |
||
163 | |||
164 | public static function taskAssign(): PermissionInterface |
||
165 | { |
||
166 | if (self::$TASK_ASSIGN === null) { |
||
167 | self::$TASK_ASSIGN = new ProcessDefinitionPermissions("TASK_ASSIGN", 32768); |
||
168 | } |
||
169 | return self::$TASK_ASSIGN; |
||
170 | } |
||
171 | |||
172 | private static $MIGRATE_INSTANCE; |
||
173 | |||
174 | public static function migrateInstance(): PermissionInterface |
||
175 | { |
||
176 | if (self::$MIGRATE_INSTANCE === null) { |
||
177 | self::$MIGRATE_INSTANCE = new ProcessDefinitionPermissions("MIGRATE_INSTANCE", 65536); |
||
178 | } |
||
179 | return self::$MIGRATE_INSTANCE; |
||
180 | } |
||
181 | |||
182 | private static $SUSPEND_INSTANCE; |
||
183 | |||
184 | public static function suspendInstance(): PermissionInterface |
||
185 | { |
||
186 | if (self::$SUSPEND_INSTANCE === null) { |
||
187 | self::$SUSPEND_INSTANCE = new ProcessDefinitionPermissions("SUSPEND_INSTANCE", 131072); |
||
188 | } |
||
189 | return self::$SUSPEND_INSTANCE; |
||
190 | } |
||
191 | |||
192 | private static $UPDATE_INSTANCE_VARIABLE; |
||
193 | |||
194 | public static function updateInstanceVariable(): PermissionInterface |
||
195 | { |
||
196 | if (self::$UPDATE_INSTANCE_VARIABLE === null) { |
||
197 | self::$UPDATE_INSTANCE_VARIABLE = new ProcessDefinitionPermissions("UPDATE_INSTANCE_VARIABLE", 262144); |
||
198 | } |
||
199 | return self::$UPDATE_INSTANCE_VARIABLE; |
||
200 | } |
||
201 | |||
202 | private static $UPDATE_TASK_VARIABLE; |
||
203 | |||
204 | public static function updateTaskVariable(): PermissionInterface |
||
205 | { |
||
206 | if (self::$UPDATE_TASK_VARIABLE === null) { |
||
207 | self::$UPDATE_TASK_VARIABLE = new ProcessDefinitionPermissions("UPDATE_TASK_VARIABLE", 524288); |
||
208 | } |
||
209 | return self::$UPDATE_TASK_VARIABLE; |
||
210 | } |
||
211 | |||
212 | private static $SUSPEND; |
||
213 | |||
214 | public static function suspend(): PermissionInterface |
||
215 | { |
||
216 | if (self::$SUSPEND === null) { |
||
217 | self::$SUSPEND = new ProcessDefinitionPermissions("SUSPEND", 1048576); |
||
218 | } |
||
219 | return self::$SUSPEND; |
||
220 | } |
||
221 | |||
222 | private static $READ_INSTANCE_VARIABLE; |
||
223 | |||
224 | public static function readInstanceVariable(): PermissionInterface |
||
225 | { |
||
226 | if (self::$READ_INSTANCE_VARIABLE === null) { |
||
227 | self::$READ_INSTANCE_VARIABLE = new ProcessDefinitionPermissions("READ_INSTANCE_VARIABLE", 2097152); |
||
228 | } |
||
229 | return self::$READ_INSTANCE_VARIABLE; |
||
230 | } |
||
231 | |||
232 | private static $READ_HISTORY_VARIABLE; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
233 | |||
234 | public static function readHistoryVariable(): PermissionInterface |
||
235 | { |
||
236 | if (self::$READ_INSTANCE_VARIABLE === null) { |
||
237 | self::$READ_INSTANCE_VARIABLE = new ProcessDefinitionPermissions("READ_HISTORY_VARIABLE", 4194304); |
||
238 | } |
||
239 | return self::$READ_INSTANCE_VARIABLE; |
||
240 | } |
||
241 | |||
242 | private static $READ_TASK_VARIABLE; |
||
243 | |||
244 | public static function readTaskVariable(): PermissionInterface |
||
245 | { |
||
246 | if (self::$READ_TASK_VARIABLE === null) { |
||
247 | self::$READ_TASK_VARIABLE = new ProcessDefinitionPermissions("READ_TASK_VARIABLE", 8388608); |
||
248 | } |
||
249 | return self::$READ_TASK_VARIABLE; |
||
250 | } |
||
251 | |||
252 | private static $UPDATE_HISTORY; |
||
253 | |||
254 | public static function updateHistory(): PermissionInterface |
||
255 | { |
||
256 | if (self::$UPDATE_HISTORY === null) { |
||
257 | self::$UPDATE_HISTORY = new ProcessDefinitionPermissions("UPDATE_HISTORY", 16777216); |
||
258 | } |
||
259 | return self::$UPDATE_HISTORY; |
||
260 | } |
||
261 | |||
262 | private static $RESOURCES; |
||
263 | |||
264 | public static function resources(): array |
||
265 | { |
||
266 | if (self::$RESOURCES === null) { |
||
267 | self::$RESOURCES = [ Resources::processDefinition() ]; |
||
268 | } |
||
269 | return self::$RESOURCES; |
||
270 | } |
||
271 | |||
272 | private function __construct(string $name, int $id) |
||
273 | { |
||
274 | $this->name = $name; |
||
275 | $this->id = $id; |
||
276 | } |
||
277 | |||
278 | public function getTypes(): array |
||
279 | { |
||
280 | return self::resources(); |
||
281 | } |
||
282 | } |
||
283 |