|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the TYPO3 CMS project. |
|
5
|
|
|
* |
|
6
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
8
|
|
|
* of the License, or any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* The TYPO3 project - inspiring people to share! |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Extbase\Domain\Model; |
|
17
|
|
|
|
|
18
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase; |
|
19
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; |
|
20
|
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* This model represents a backend usergroup. |
|
24
|
|
|
*/ |
|
25
|
|
|
class BackendUserGroup extends AbstractEntity |
|
26
|
|
|
{ |
|
27
|
|
|
const FILE_OPPERATIONS = 1; |
|
28
|
|
|
const DIRECTORY_OPPERATIONS = 4; |
|
29
|
|
|
const DIRECTORY_COPY = 8; |
|
30
|
|
|
const DIRECTORY_REMOVE_RECURSIVELY = 16; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
* @Extbase\Validate("NotEmpty") |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $title = ''; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $description = ''; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup> |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $subGroups; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var string |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $modules = ''; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var string |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $tablesListening = ''; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var string |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $tablesModify = ''; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var string |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $pageTypes = ''; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $allowedExcludeFields = ''; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $explicitlyAllowAndDeny = ''; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $allowedLanguages = ''; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @var bool |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $workspacePermission = false; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @var string |
|
90
|
|
|
*/ |
|
91
|
|
|
protected $databaseMounts = ''; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @var int |
|
95
|
|
|
*/ |
|
96
|
|
|
protected $fileOperationPermissions = 0; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @var string |
|
100
|
|
|
*/ |
|
101
|
|
|
protected $tsConfig = ''; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Constructs this backend usergroup |
|
105
|
|
|
*/ |
|
106
|
|
|
public function __construct() |
|
107
|
|
|
{ |
|
108
|
|
|
$this->subGroups = new ObjectStorage(); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Setter for title |
|
113
|
|
|
* |
|
114
|
|
|
* @param string $title |
|
115
|
|
|
*/ |
|
116
|
|
|
public function setTitle($title) |
|
117
|
|
|
{ |
|
118
|
|
|
$this->title = $title; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Getter for title |
|
123
|
|
|
* |
|
124
|
|
|
* @return string |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getTitle() |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->title; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* Setter for description |
|
133
|
|
|
* |
|
134
|
|
|
* @param string $description |
|
135
|
|
|
*/ |
|
136
|
|
|
public function setDescription($description) |
|
137
|
|
|
{ |
|
138
|
|
|
$this->description = $description; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* Getter for description |
|
143
|
|
|
* |
|
144
|
|
|
* @return string |
|
145
|
|
|
*/ |
|
146
|
|
|
public function getDescription() |
|
147
|
|
|
{ |
|
148
|
|
|
return $this->description; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Setter for the sub groups |
|
153
|
|
|
* |
|
154
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $subGroups |
|
155
|
|
|
*/ |
|
156
|
|
|
public function setSubGroups(ObjectStorage $subGroups) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->subGroups = $subGroups; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* Adds a sub group to this backend user group |
|
163
|
|
|
* |
|
164
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup $beGroup |
|
165
|
|
|
*/ |
|
166
|
|
|
public function addSubGroup(\TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup $beGroup) |
|
167
|
|
|
{ |
|
168
|
|
|
$this->subGroups->attach($beGroup); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Removes sub group from this backend user group |
|
173
|
|
|
* |
|
174
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup $groupToDelete |
|
175
|
|
|
*/ |
|
176
|
|
|
public function removeSubGroup(\TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup $groupToDelete) |
|
177
|
|
|
{ |
|
178
|
|
|
$this->subGroups->detach($groupToDelete); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* Remove all sub groups from this backend user group |
|
183
|
|
|
*/ |
|
184
|
|
|
public function removeAllSubGroups() |
|
185
|
|
|
{ |
|
186
|
|
|
$subGroups = clone $this->subGroups; |
|
187
|
|
|
$this->subGroups->removeAll($subGroups); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* Getter of sub groups |
|
192
|
|
|
* |
|
193
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
|
194
|
|
|
*/ |
|
195
|
|
|
public function getSubGroups() |
|
196
|
|
|
{ |
|
197
|
|
|
return $this->subGroups; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* Setter for modules |
|
202
|
|
|
* |
|
203
|
|
|
* @param string $modules |
|
204
|
|
|
*/ |
|
205
|
|
|
public function setModules($modules) |
|
206
|
|
|
{ |
|
207
|
|
|
$this->modules = $modules; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* Getter for modules |
|
212
|
|
|
* |
|
213
|
|
|
* @return string |
|
214
|
|
|
*/ |
|
215
|
|
|
public function getModules() |
|
216
|
|
|
{ |
|
217
|
|
|
return $this->modules; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* Setter for tables listening |
|
222
|
|
|
* |
|
223
|
|
|
* @param string $tablesListening |
|
224
|
|
|
*/ |
|
225
|
|
|
public function setTablesListening($tablesListening) |
|
226
|
|
|
{ |
|
227
|
|
|
$this->tablesListening = $tablesListening; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* Getter for tables listening |
|
232
|
|
|
* |
|
233
|
|
|
* @return string |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getTablesListening() |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->tablesListening; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* Setter for tables modify |
|
242
|
|
|
* |
|
243
|
|
|
* @param string $tablesModify |
|
244
|
|
|
*/ |
|
245
|
|
|
public function setTablesModify($tablesModify) |
|
246
|
|
|
{ |
|
247
|
|
|
$this->tablesModify = $tablesModify; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* Getter for tables modify |
|
252
|
|
|
* |
|
253
|
|
|
* @return string |
|
254
|
|
|
*/ |
|
255
|
|
|
public function getTablesModify() |
|
256
|
|
|
{ |
|
257
|
|
|
return $this->tablesModify; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* Setter for page types |
|
262
|
|
|
* |
|
263
|
|
|
* @param string $pageTypes |
|
264
|
|
|
*/ |
|
265
|
|
|
public function setPageTypes($pageTypes) |
|
266
|
|
|
{ |
|
267
|
|
|
$this->pageTypes = $pageTypes; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* Getter for page types |
|
272
|
|
|
* |
|
273
|
|
|
* @return string |
|
274
|
|
|
*/ |
|
275
|
|
|
public function getPageTypes() |
|
276
|
|
|
{ |
|
277
|
|
|
return $this->pageTypes; |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
/** |
|
281
|
|
|
* Setter for allowed exclude fields |
|
282
|
|
|
* |
|
283
|
|
|
* @param string $allowedExcludeFields |
|
284
|
|
|
*/ |
|
285
|
|
|
public function setAllowedExcludeFields($allowedExcludeFields) |
|
286
|
|
|
{ |
|
287
|
|
|
$this->allowedExcludeFields = $allowedExcludeFields; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
/** |
|
291
|
|
|
* Getter for allowed exclude fields |
|
292
|
|
|
* |
|
293
|
|
|
* @return string |
|
294
|
|
|
*/ |
|
295
|
|
|
public function getAllowedExcludeFields() |
|
296
|
|
|
{ |
|
297
|
|
|
return $this->allowedExcludeFields; |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* Setter for explicitly allow and deny |
|
302
|
|
|
* |
|
303
|
|
|
* @param string $explicitlyAllowAndDeny |
|
304
|
|
|
*/ |
|
305
|
|
|
public function setExplicitlyAllowAndDeny($explicitlyAllowAndDeny) |
|
306
|
|
|
{ |
|
307
|
|
|
$this->explicitlyAllowAndDeny = $explicitlyAllowAndDeny; |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
/** |
|
311
|
|
|
* Getter for explicitly allow and deny |
|
312
|
|
|
* |
|
313
|
|
|
* @return string |
|
314
|
|
|
*/ |
|
315
|
|
|
public function getExplicitlyAllowAndDeny() |
|
316
|
|
|
{ |
|
317
|
|
|
return $this->explicitlyAllowAndDeny; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
/** |
|
321
|
|
|
* Setter for allowed languages |
|
322
|
|
|
* |
|
323
|
|
|
* @param string $allowedLanguages |
|
324
|
|
|
*/ |
|
325
|
|
|
public function setAllowedLanguages($allowedLanguages) |
|
326
|
|
|
{ |
|
327
|
|
|
$this->allowedLanguages = $allowedLanguages; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
/** |
|
331
|
|
|
* Getter for allowed languages |
|
332
|
|
|
* |
|
333
|
|
|
* @return string |
|
334
|
|
|
*/ |
|
335
|
|
|
public function getAllowedLanguages() |
|
336
|
|
|
{ |
|
337
|
|
|
return $this->allowedLanguages; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
/** |
|
341
|
|
|
* Setter for workspace permission |
|
342
|
|
|
* |
|
343
|
|
|
* @param bool $workspacePermission |
|
344
|
|
|
*/ |
|
345
|
|
|
public function setWorkspacePermissions($workspacePermission) |
|
346
|
|
|
{ |
|
347
|
|
|
$this->workspacePermission = $workspacePermission; |
|
348
|
|
|
} |
|
349
|
|
|
|
|
350
|
|
|
/** |
|
351
|
|
|
* Getter for workspace permission |
|
352
|
|
|
* |
|
353
|
|
|
* @return bool |
|
354
|
|
|
*/ |
|
355
|
|
|
public function getWorkspacePermission() |
|
356
|
|
|
{ |
|
357
|
|
|
return $this->workspacePermission; |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
/** |
|
361
|
|
|
* Setter for database mounts |
|
362
|
|
|
* |
|
363
|
|
|
* @param string $databaseMounts |
|
364
|
|
|
*/ |
|
365
|
|
|
public function setDatabaseMounts($databaseMounts) |
|
366
|
|
|
{ |
|
367
|
|
|
$this->databaseMounts = $databaseMounts; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
|
|
/** |
|
371
|
|
|
* Getter for database mounts |
|
372
|
|
|
* |
|
373
|
|
|
* @return string |
|
374
|
|
|
*/ |
|
375
|
|
|
public function getDatabaseMounts() |
|
376
|
|
|
{ |
|
377
|
|
|
return $this->databaseMounts; |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
/** |
|
381
|
|
|
* Getter for file operation permissions |
|
382
|
|
|
* |
|
383
|
|
|
* @param int $fileOperationPermissions |
|
384
|
|
|
*/ |
|
385
|
|
|
public function setFileOperationPermissions($fileOperationPermissions) |
|
386
|
|
|
{ |
|
387
|
|
|
$this->fileOperationPermissions = $fileOperationPermissions; |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* Getter for file operation permissions |
|
392
|
|
|
* |
|
393
|
|
|
* @return int |
|
394
|
|
|
*/ |
|
395
|
|
|
public function getFileOperationPermissions() |
|
396
|
|
|
{ |
|
397
|
|
|
return $this->fileOperationPermissions; |
|
398
|
|
|
} |
|
399
|
|
|
|
|
400
|
|
|
/** |
|
401
|
|
|
* Check if file operations like upload, copy, move, delete, rename, new and |
|
402
|
|
|
* edit files is allowed. |
|
403
|
|
|
* |
|
404
|
|
|
* @return bool |
|
405
|
|
|
*/ |
|
406
|
|
|
public function isFileOperationAllowed() |
|
407
|
|
|
{ |
|
408
|
|
|
return $this->isPermissionSet(self::FILE_OPPERATIONS); |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* Set the the bit for file operations are allowed. |
|
413
|
|
|
* |
|
414
|
|
|
* @param bool $value |
|
415
|
|
|
*/ |
|
416
|
|
|
public function setFileOperationAllowed($value) |
|
417
|
|
|
{ |
|
418
|
|
|
$this->setPermission(self::FILE_OPPERATIONS, $value); |
|
419
|
|
|
} |
|
420
|
|
|
|
|
421
|
|
|
/** |
|
422
|
|
|
* Check if folder operations like move, delete, rename, and new are allowed. |
|
423
|
|
|
* |
|
424
|
|
|
* @return bool |
|
425
|
|
|
*/ |
|
426
|
|
|
public function isDirectoryOperationAllowed() |
|
427
|
|
|
{ |
|
428
|
|
|
return $this->isPermissionSet(self::DIRECTORY_OPPERATIONS); |
|
429
|
|
|
} |
|
430
|
|
|
|
|
431
|
|
|
/** |
|
432
|
|
|
* Set the the bit for directory operations are allowed. |
|
433
|
|
|
* |
|
434
|
|
|
* @param bool $value |
|
435
|
|
|
*/ |
|
436
|
|
|
public function setDirectoryOperationAllowed($value) |
|
437
|
|
|
{ |
|
438
|
|
|
$this->setPermission(self::DIRECTORY_OPPERATIONS, $value); |
|
439
|
|
|
} |
|
440
|
|
|
|
|
441
|
|
|
/** |
|
442
|
|
|
* Check if it is allowed to copy folders. |
|
443
|
|
|
* |
|
444
|
|
|
* @return bool |
|
445
|
|
|
*/ |
|
446
|
|
|
public function isDirectoryCopyAllowed() |
|
447
|
|
|
{ |
|
448
|
|
|
return $this->isPermissionSet(self::DIRECTORY_COPY); |
|
449
|
|
|
} |
|
450
|
|
|
|
|
451
|
|
|
/** |
|
452
|
|
|
* Set the the bit for copy directories. |
|
453
|
|
|
* |
|
454
|
|
|
* @param bool $value |
|
455
|
|
|
*/ |
|
456
|
|
|
public function setDirectoryCopyAllowed($value) |
|
457
|
|
|
{ |
|
458
|
|
|
$this->setPermission(self::DIRECTORY_COPY, $value); |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
/** |
|
462
|
|
|
* Check if it is allowed to remove folders recursively. |
|
463
|
|
|
* |
|
464
|
|
|
* @return bool |
|
465
|
|
|
*/ |
|
466
|
|
|
public function isDirectoryRemoveRecursivelyAllowed() |
|
467
|
|
|
{ |
|
468
|
|
|
return $this->isPermissionSet(self::DIRECTORY_REMOVE_RECURSIVELY); |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
/** |
|
472
|
|
|
* Set the the bit for remove directories recursively. |
|
473
|
|
|
* |
|
474
|
|
|
* @param bool $value |
|
475
|
|
|
*/ |
|
476
|
|
|
public function setDirectoryRemoveRecursivelyAllowed($value) |
|
477
|
|
|
{ |
|
478
|
|
|
$this->setPermission(self::DIRECTORY_REMOVE_RECURSIVELY, $value); |
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
/** |
|
482
|
|
|
* Setter for ts config |
|
483
|
|
|
* |
|
484
|
|
|
* @param string $tsConfig |
|
485
|
|
|
*/ |
|
486
|
|
|
public function setTsConfig($tsConfig) |
|
487
|
|
|
{ |
|
488
|
|
|
$this->tsConfig = $tsConfig; |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
|
|
/** |
|
492
|
|
|
* Getter for ts config |
|
493
|
|
|
* |
|
494
|
|
|
* @return string |
|
495
|
|
|
*/ |
|
496
|
|
|
public function getTsConfig() |
|
497
|
|
|
{ |
|
498
|
|
|
return $this->tsConfig; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* Helper method for checking the permissions bitwise. |
|
503
|
|
|
* |
|
504
|
|
|
* @param int $permission |
|
505
|
|
|
* @return bool |
|
506
|
|
|
*/ |
|
507
|
|
|
protected function isPermissionSet($permission) |
|
508
|
|
|
{ |
|
509
|
|
|
return ($this->fileOperationPermissions & $permission) == $permission; |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
/** |
|
513
|
|
|
* Helper method for setting permissions bitwise. |
|
514
|
|
|
* |
|
515
|
|
|
* @param int $permission |
|
516
|
|
|
* @param bool $value |
|
517
|
|
|
*/ |
|
518
|
|
|
protected function setPermission($permission, $value) |
|
519
|
|
|
{ |
|
520
|
|
|
if ($value) { |
|
521
|
|
|
$this->fileOperationPermissions |= $permission; |
|
522
|
|
|
} else { |
|
523
|
|
|
$this->fileOperationPermissions &= ~$permission; |
|
524
|
|
|
} |
|
525
|
|
|
} |
|
526
|
|
|
} |
|
527
|
|
|
|