[TASK] Set extension version and dependencies to 7.2
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Classes / Domain / Model / BackendUser.php
1 <?php
2 namespace TYPO3\CMS\Beuser\Domain\Model;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Model for backend user
19 *
20 * @author Felix Kopp <felix-source@phorax.com>
21 */
22 class BackendUser extends \TYPO3\CMS\Extbase\Domain\Model\BackendUser {
23
24 /**
25 * Comma separated list of uids in multi-select
26 * Might retrieve the labels from TCA/DataMapper
27 *
28 * @var string
29 */
30 protected $allowedLanguages = '';
31
32 /**
33 * @var string
34 */
35 protected $dbMountPoints = '';
36
37 /**
38 * @var string
39 */
40 protected $fileMountPoints = '';
41
42 /**
43 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup>
44 */
45 protected $backendUserGroups;
46
47 /**
48 * @param string $allowedLanguages
49 * @return void
50 */
51 public function setAllowedLanguages($allowedLanguages) {
52 $this->allowedLanguages = $allowedLanguages;
53 }
54
55 /**
56 * @return string
57 */
58 public function getAllowedLanguages() {
59 return $this->allowedLanguages;
60 }
61
62 /**
63 * @param string
64 * @return void
65 */
66 public function setDbMountPoints($dbMountPoints) {
67 $this->dbMountPoints = $dbMountPoints;
68 }
69
70 /**
71 * @return string
72 */
73 public function getDbMountPoints() {
74 return $this->dbMountPoints;
75 }
76
77 /**
78 * @param string $fileMountPoints
79 * @return void
80 */
81 public function setFileMountPoints($fileMountPoints) {
82 $this->fileMountPoints = $fileMountPoints;
83 }
84
85 /**
86 * @return string
87 */
88 public function getFileMountPoints() {
89 return $this->fileMountPoints;
90 }
91
92 /**
93 * Check if user is active, not disabled
94 *
95 * @return bool
96 */
97 public function isActive() {
98 if ($this->getIsDisabled()) {
99 return FALSE;
100 }
101 $now = new \DateTime('now');
102 return !$this->getStartDateAndTime() && !$this->getEndDateAndTime() || $this->getStartDateAndTime() <= $now && (!$this->getEndDateAndTime() || $this->getEndDateAndTime() > $now);
103 }
104
105 /**
106 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $backendUserGroups
107 */
108 public function setBackendUserGroups($backendUserGroups) {
109 $this->backendUserGroups = $backendUserGroups;
110 }
111
112 /**
113 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
114 */
115 public function getBackendUserGroups() {
116 return $this->backendUserGroups;
117 }
118
119 /**
120 * Check if user is currently logged in
121 *
122 * @return bool
123 */
124 public function isCurrentlyLoggedIn() {
125 return $this->getUid() === (int)$this->getBackendUser()->user['uid'];
126 }
127
128 /**
129 * Gets the currently logged in backend user
130 *
131 * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
132 */
133 public function getBackendUser() {
134 return $GLOBALS['BE_USER'];
135 }
136
137 }