2 /***************************************************************
5 * (c) 2012 Markus Günther <mail@markus-guenther.de>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
28 * This model represents a backend usergroup.
30 * @author Markus Günther <mail@markus-guenther.de>
33 * @subpackage Domain\Model
39 class Tx_Extbase_Domain_Model_BackendUserGroup
extends Tx_Extbase_DomainObject_AbstractEntity
{
41 const FILE_OPPERATIONS
= 1;
43 const DIRECTORY_OPPERATIONS
= 4;
44 const DIRECTORY_COPY
= 8;
45 const DIRECTORY_REMOVE_RECURSIVELY
= 16;
51 protected $title = '';
56 protected $description = '';
59 * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Extbase_Domain_Model_BackendUserGroup>
66 protected $modules = '';
71 protected $tablesListening = '';
76 protected $tablesModify = '';
81 protected $pageTypes = '';
86 protected $allowedExcludeFields = '';
91 protected $explicitlyAllowAndDeny = '';
96 protected $allowedLanguages = '';
101 protected $workspacePermission = FALSE;
106 protected $databaseMounts = '';
111 protected $fileOperationPermissions = 0;
116 protected $lockToDomain = '';
121 protected $hideInList = FALSE;
126 protected $tsConfig = '';
129 * Constructs this backend usergroup
131 public function __construct() {
132 $this->subGroups
= new Tx_Extbase_Persistence_ObjectStorage();
138 * @param string $title
141 public function setTitle($title) {
142 $this->title
= $title;
150 public function getTitle() {
155 * Setter for description
157 * @param string $description
160 public function setDescription($description) {
161 $this->description
= $description;
165 * Getter for description
169 public function getDescription() {
170 return $this->description
;
174 * Setter for the sub groups
176 * @param Tx_Extbase_Persistence_ObjectStorage $subGroups
179 public function setSubGroups(Tx_Extbase_Persistence_ObjectStorage
$subGroups) {
180 $this->subGroups
= $subGroups;
184 * Adds a sub group to this backend user group
186 * @param Tx_Extbase_Domain_Model_BackendUserGroup $beGroup
189 public function addSubGroup(Tx_Extbase_Domain_Model_BackendUserGroup
$beGroup) {
190 $this->subGroups
->attach($beGroup);
194 * Removes sub group from this backend user group
196 * @param Tx_Extbase_Domain_Model_BackendUserGroup $groupToDelete
199 public function removeSubGroup(Tx_Extbase_Domain_Model_BackendUserGroup
$groupToDelete) {
200 $this->subGroups
->detach($groupToDelete);
204 * Remove all sub groups from this backend user group
208 public function removeAllSubGroups() {
209 $subGroups = clone $this->subGroups
;
210 $this->subGroups
->removeAll($subGroups);
214 * Getter of sub groups
216 * @return Tx_Extbase_Persistence_ObjectStorage
218 public function getSubGroups() {
219 return $this->subGroups
;
225 * @param string $modules
228 public function setModules($modules) {
229 $this->modules
= $modules;
237 public function getModules() {
238 return $this->modules
;
242 * Setter for tables listening
244 * @param string $tablesListening
247 public function setTablesListening($tablesListening) {
248 $this->tablesListening
= $tablesListening;
252 * Getter for tables listening
256 public function getTablesListening() {
257 return $this->tablesListening
;
261 * Setter for tables modify
263 * @param string $tablesModify
266 public function setTablesModify($tablesModify) {
267 $this->tablesModify
= $tablesModify;
271 * Getter for tables modify
275 public function getTablesModify() {
276 return $this->tablesModify
;
280 * Setter for page types
282 * @param string $pageTypes
285 public function setPageTypes($pageTypes) {
286 $this->pageTypes
= $pageTypes;
290 * Getter for page types
294 public function getPageTypes() {
295 return $this->pageTypes
;
299 * Setter for allowed exclude fields
301 * @param string $allowedExcludeFields
304 public function setAllowedExcludeFields($allowedExcludeFields) {
305 $this->allowedExcludeFields
= $allowedExcludeFields;
309 * Getter for allowed exclude fields
313 public function getAllowedExcludeFields() {
314 return $this->allowedExcludeFields
;
318 * Setter for explicitly allow and deny
320 * @param string $explicitlyAllowAndDeny
323 public function setExplicitlyAllowAndDeny($explicitlyAllowAndDeny) {
324 $this->explicitlyAllowAndDeny
= $explicitlyAllowAndDeny;
328 * Getter for explicitly allow and deny
332 public function getExplicitlyAllowAndDeny() {
333 return $this->explicitlyAllowAndDeny
;
337 * Setter for allowed languages
339 * @param string $allowedLanguages
342 public function setAllowedLanguages($allowedLanguages) {
343 $this->allowedLanguages
= $allowedLanguages;
347 * Getter for allowed languages
351 public function getAllowedLanguages() {
352 return $this->allowedLanguages
;
356 * Setter for workspace permission
358 * @param boolean $workspacePermission
361 public function setWorkspacePermissions($workspacePermission) {
362 $this->workspacePermission
= $workspacePermission;
366 * Getter for workspace permission
370 public function getWorkspacePermission() {
371 return $this->workspacePermission
;
375 * Setter for database mounts
377 * @param string $databaseMounts
380 public function setDatabaseMounts($databaseMounts) {
381 $this->databaseMounts
= $databaseMounts;
385 * Getter for database mounts
389 public function getDatabaseMounts() {
390 return $this->databaseMounts
;
394 * Getter for file operation permissions
396 * @param integer $fileOperationPermissions
399 public function setFileOperationPermissions($fileOperationPermissions) {
400 $this->fileOperationPermissions
= $fileOperationPermissions;
404 * Getter for file operation permissions
408 public function getFileOperationPermissions() {
409 return $this->fileOperationPermissions
;
413 * Check if file operations like upload, copy, move, delete, rename, new and
414 * edit files is allowed.
418 public function isFileOperationAllowed() {
419 return $this->isPermissionSet(self
::FILE_OPPERATIONS
);
423 * Set the the bit for file operations are allowed.
428 public function setFileOperationAllowed($value) {
429 $this->setPermission(self
::FILE_OPPERATIONS
, $value);
433 * Check if it is allowed to unzip files.
437 public function isFileUnzipAllowed() {
438 return $this->isPermissionSet(self
::FILE_UNZIP
);
442 * Set the the bit for unzip files are allowed.
447 public function setFileUnzipAllowed($value) {
448 $this->setPermission(self
::FILE_UNZIP
, $value);
452 * Check if folder operations like move, delete, rename, and new are allowed.
456 public function isDirectoryOperationAllowed() {
457 return $this->isPermissionSet(self
::DIRECTORY_OPPERATIONS
);
461 * Set the the bit for directory operations are allowed.
466 public function setDirectoryOperationAllowed($value) {
467 $this->setPermission(self
::DIRECTORY_OPPERATIONS
, $value);
471 * Check if it is allowed to copy folders.
475 public function isDirectoryCopyAllowed() {
476 return $this->isPermissionSet(self
::DIRECTORY_COPY
);
480 * Set the the bit for copy directories.
485 public function setDirectoryCopyAllowed($value) {
486 $this->setPermission(self
::DIRECTORY_COPY
, $value);
490 * Check if it is allowed to remove folders recursively.
494 public function isDirectoryRemoveRecursivelyAllowed() {
495 return $this->isPermissionSet(self
::DIRECTORY_REMOVE_RECURSIVELY
);
499 * Set the the bit for remove directories recursively.
504 public function setDirectoryRemoveRecursivelyAllowed($value) {
505 $this->setPermission(self
::DIRECTORY_REMOVE_RECURSIVELY
, $value);
509 * Setter for lock to domain
511 * @param string $lockToDomain
514 public function setLockToDomain($lockToDomain) {
515 $this->lockToDomain
= $lockToDomain;
519 * Getter for lock to domain
522 public function getLockToDomain() {
523 return $this->lockToDomain
;
527 * Setter for hide in list
529 * @param boolean $hideInList
532 public function setHideInList($hideInList) {
533 $this->hideInList
= $hideInList;
537 * Getter for hide in list
541 public function getHideInList() {
542 return $this->hideInList
;
546 * Setter for ts config
548 * @param string $tsConfig
550 public function setTsConfig($tsConfig) {
551 $this->tsConfig
= $tsConfig;
555 * Getter for ts config
559 public function getTsConfig() {
560 return $this->tsConfig
;
564 * Helper method for checking the permissions bitwise.
566 * @param integer $permission
569 protected function isPermissionSet($permission) {
570 return (($this->fileOperationPermissions
& $permission) == $permission);
574 * Helper method for settung permissions bitwise.
576 * @param integer $permission
577 * @param boolean $value
580 protected function setPermission($permission, $value) {
582 $this->fileOperationPermissions |
= $permission;
584 $this->fileOperationPermissions
&= ~
$permission;