54 'filemounts' => array()
105 'webmount_list' =>
'',
106 'filemount_list' =>
'',
107 'file_permissions' =>
'',
109 'tables_select' =>
'',
110 'tables_modify' =>
'',
111 'pagetypes_select' =>
'',
112 'non_exclude_fields' =>
'',
113 'explicit_allowdeny' =>
'',
114 'allowed_languages' =>
'',
115 'workspace_perms' =>
'',
116 'custom_options' =>
'' 253 'deleted' =>
'deleted',
254 'disabled' =>
'disable',
255 'starttime' =>
'starttime',
256 'endtime' =>
'endtime' 339 'interfaceSetup' =>
'',
341 'moduleData' => array(),
343 'thumbnailsByDefault' => 1,
344 'emailMeAtLogin' => 0,
346 'startModule' =>
'help_aboutmodules',
347 'hideSubmoduleIcons' => 0,
350 'edit_showFieldHelp' =>
'icon',
352 'edit_docModuleUpload' =>
'1',
353 'navFrameWidth' =>
'',
355 'navFrameResizable' => 0,
356 'resizeTextareas' => 1,
357 'resizeTextareas_MaxHeight' => 500,
358 'resizeTextareas_Flexible' => 0
365 parent::__construct();
366 $this->name = self::getCookieName();
367 $this->loginType =
'BE';
378 return is_array($this->user) && ($this->user[
'admin'] & 1) == 1;
391 $groupId = (int)$groupId;
392 if ($this->groupList && $groupId) {
416 return ($userPerms & $perms) == $perms;
437 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'lockBeUserToDBmounts'] || $this->
isAdmin()) {
442 $checkRec = BackendUtility::getRecord(
'pages',
$id,
'pid,t3ver_oid');
443 if ($checkRec[
'pid'] == -1) {
444 $id = (int)$checkRec[
't3ver_oid'];
452 foreach ($rL as $v) {
453 if ($v[
'uid'] && in_array($v[
'uid'], $wM)) {
459 throw new \RuntimeException(
'Access Error: This page is not within your DB-mounts', 1294586445);
476 throw new \RuntimeException(
'Fatal Error: This module "' . $conf[
'name'] .
'" is not enabled in TBE_MODULES', 1294586446);
482 !empty($conf[
'workspaces'])
483 && \
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'workspaces')
489 throw new \RuntimeException(
'Workspace Error: This module "' . $conf[
'name'] .
'" is not available under the current workspace', 1294586447);
494 if (!$conf[
'access'] || $this->
isAdmin()) {
499 if (!strstr($conf[
'access'],
'admin') && $conf[
'name']) {
500 $acs = $this->
check(
'modules', $conf[
'name']);
502 if (!$acs && $exitOnError) {
503 throw new \RuntimeException(
'Access Error: You don\'t have access to this module.', 1294586448);
526 if (is_array($this->user)) {
530 $perms = (int)$perms;
532 $str =
' (' .
'(pages.perms_everybody & ' . $perms .
' = ' . $perms .
')' .
' OR (pages.perms_userid = ' 533 . $this->user[
'uid'] .
' AND pages.perms_user & ' . $perms .
' = ' . $perms .
')';
535 if ($this->groupList) {
537 $str .=
' OR (pages.perms_groupid in (' . $this->groupList .
') AND pages.perms_group & ' 538 . $perms .
' = ' . $perms .
')';
544 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'getPagePermsClause'])) {
545 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'getPagePermsClause'] as $_funcRef) {
546 $_params = array(
'currentClause' => $str,
'perms' => $perms);
577 isset($row[
'perms_userid']) && isset($row[
'perms_user']) && isset($row[
'perms_groupid'])
578 && isset($row[
'perms_group']) && isset($row[
'perms_everybody']) && isset($this->groupList)
580 if ($this->user[
'uid'] == $row[
'perms_userid']) {
581 $out |= $row[
'perms_user'];
584 $out |= $row[
'perms_group'];
586 $out |= $row[
'perms_everybody'];
591 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'calcPerms'])) {
592 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'calcPerms'] as $_funcRef) {
595 'outputPermissions' => $out
614 $this->RTE_errors = array();
615 if (!$this->uc[
'edit_RTE']) {
616 $this->RTE_errors[] =
'RTE is not enabled for user!';
618 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'RTEenabled']) {
619 $this->RTE_errors[] =
'RTE is not enabled in $TYPO3_CONF_VARS["BE"]["RTEenabled"]';
623 if (!is_object($RTE)) {
624 $this->RTE_errors = array_merge($this->RTE_errors, $RTE);
626 if (!count($this->RTE_errors)) {
644 public function check($type, $value) {
645 if (isset($this->groupData[$type])) {
669 if ((
string)$value ===
'') {
673 if (preg_match(
'/[:|,]/', $value)) {
677 $testValue = $table .
':' . $field .
':' . $value;
680 switch ((
string) $authMode) {
681 case 'explicitAllow':
692 if (is_array(
$GLOBALS[
'TCA'][$table]) && is_array(
$GLOBALS[
'TCA'][$table][
'columns'][$field])) {
693 $items =
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'];
694 if (is_array($items)) {
695 foreach ($items as $iCfg) {
696 if ((
string)$iCfg[1] === (
string)$value && $iCfg[4]) {
697 switch ((
string)$iCfg[4]) {
728 if (trim($this->groupData[
'allowed_languages']) !==
'') {
729 $langValue = (int)$langValue;
731 if ($langValue != -1 && !$this->
check(
'allowed_languages', $langValue)) {
749 if (isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transForeignTable'])) {
750 $l10nTable =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transForeignTable'];
751 $pointerField =
$GLOBALS[
'TCA'][$l10nTable][
'ctrl'][
'transOrigPointerField'];
752 $pointerValue = $record[
'uid'];
755 $pointerField =
$GLOBALS[
'TCA'][$l10nTable][
'ctrl'][
'transOrigPointerField'];
756 $pointerValue = $record[$pointerField] > 0 ? $record[$pointerField] : $record[
'uid'];
759 if (is_array($recordLocalizations)) {
760 foreach ($recordLocalizations as $localization) {
761 $recordLocalizationAccess = $recordLocalizationAccess
763 if (!$recordLocalizationAccess) {
769 return $recordLocalizationAccess;
788 public function recordEditAccessInternals($table, $idOrRow, $newRecord = FALSE, $deletedRecord = FALSE, $checkFullLanguageAccess = FALSE) {
789 if (!isset(
$GLOBALS[
'TCA'][$table])) {
797 if (!is_array($idOrRow)) {
798 if ($deletedRecord) {
799 $idOrRow = BackendUtility::getRecord($table, $idOrRow,
'*',
'', FALSE);
801 $idOrRow = BackendUtility::getRecord($table, $idOrRow);
803 if (!is_array($idOrRow)) {
804 $this->errorMsg =
'ERROR: Record could not be fetched.';
809 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']) {
811 if (isset($idOrRow[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']])) {
813 $this->errorMsg =
'ERROR: Language was not allowed.';
816 $checkFullLanguageAccess && $idOrRow[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']] == 0
819 $this->errorMsg =
'ERROR: Related/affected language was not allowed.';
823 $this->errorMsg =
'ERROR: The "languageField" field named "' 824 .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'] .
'" was not found in testing record!';
828 isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transForeignTable']) && $checkFullLanguageAccess &&
834 if (is_array(
$GLOBALS[
'TCA'][$table][
'columns'])) {
835 foreach (
$GLOBALS[
'TCA'][$table][
'columns'] as $fieldName => $fieldValue) {
836 if (isset($idOrRow[$fieldName])) {
838 $fieldValue[
'config'][
'type'] ===
'select' && $fieldValue[
'config'][
'authMode']
839 && $fieldValue[
'config'][
'authMode_enforce'] ===
'strict' 841 if (!$this->
checkAuthMode($table, $fieldName, $idOrRow[$fieldName], $fieldValue[
'config'][
'authMode'])) {
842 $this->errorMsg =
'ERROR: authMode "' . $fieldValue[
'config'][
'authMode']
843 .
'" failed for field "' . $fieldName .
'" with value "' 844 . $idOrRow[$fieldName] .
'" evaluated';
852 if (!$newRecord &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'editlock']) {
853 if (isset($idOrRow[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'editlock']])) {
854 if ($idOrRow[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'editlock']]) {
855 $this->errorMsg =
'ERROR: Record was locked for editing. Only admin users can change this state.';
859 $this->errorMsg =
'ERROR: The "editLock" field named "' .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'editlock']
860 .
'" was not found in testing record!';
867 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'recordEditAccessInternals'])) {
868 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'recordEditAccessInternals'] as $funcRef) {
871 'idOrRow' => $idOrRow,
872 'newRecord' => $newRecord
893 public function isPSet($compiledPermissions, $tableName, $actionType =
'') {
896 } elseif ($tableName ==
'pages') {
897 switch ($actionType) {
899 $result = ($compiledPermissions & 2) !== 0;
903 $result = ($compiledPermissions & 8 + 16) !== 0;
906 $result = ($compiledPermissions & 4) !== 0;
909 $result = ($compiledPermissions & 16) !== 0;
915 $result = ($compiledPermissions & 16) !== 0;
945 if ($this->workspace !== 0) {
946 if (!is_array($recData)) {
947 $recData = BackendUtility::getRecord(
950 'pid' . (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS'] ?
',t3ver_wsid,t3ver_stage' :
'')
953 if (is_array($recData)) {
956 if ((
int)$recData[
'pid'] === -1) {
958 if (!
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
959 return 'Versioning disabled for table';
960 } elseif ((
int)$recData[
't3ver_wsid'] !== $this->workspace) {
962 return 'Workspace ID of record didn\'t match current workspace';
967 :
'User\'s access level did not allow for editing';
977 :
'Stage for versioning root point and users access level did not allow for editing';
980 return 'Online record was not in versionized branch!';
1002 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
1003 if (!is_array($recData)) {
1004 $recData = BackendUtility::getRecord($table, $recData,
'uid,pid,t3ver_wsid,t3ver_stage');
1006 if (is_array($recData)) {
1007 if ((
int)$recData[
'pid'] === -1) {
1010 return 'Not an offline version';
1016 return 'Table does not support versioning.';
1036 $this->workspace === 0
1037 || $this->workspaceRec[
'live_edit'] && !
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']
1038 ||
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS_alwaysAllowLiveEdit']
1063 } elseif (!
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
1084 $this->workspace !== 0 && !$this->workspaceRec[
'disable_autocreate']
1085 &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS'] && $recpid >= 0
1090 } elseif ($this->workspaceRec[
'disable_autocreate']) {
1111 if ($this->workspace !== 0 && \
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'workspaces')) {
1112 $stage = (int)$stage;
1115 $workspaceRec = BackendUtility::getRecord(
'sys_workspace', $stat[
'uid']);
1116 if (
$workspaceRec[
'custom_stages'] > 0 && $stage !== 0 && $stage !== -10) {
1118 $workspaceStageRec = BackendUtility::getRecord(
'sys_workspace_stage', $stage);
1121 $stat[
'_ACCESS'] ===
'owner' 1122 || $stat[
'_ACCESS'] ===
'member' 1128 foreach ($this->userGroupsUID as $groupUid) {
1130 $stat[
'_ACCESS'] ===
'owner' 1131 || $stat[
'_ACCESS'] ===
'member' 1137 } elseif ($stage == -10 || $stage == -20) {
1138 if ($stat[
'_ACCESS'] ===
'owner') {
1144 $memberStageLimit = $this->workspaceRec[
'review_stage_edit'] ? 1 : 0;
1146 $stat[
'_ACCESS'] ===
'owner' 1147 || $stat[
'_ACCESS'] ===
'reviewer' && $stage <= 1
1148 || $stat[
'_ACCESS'] ===
'member' && $stage <= $memberStageLimit
1179 switch ($wsAccess[
'uid']) {
1187 $retVal = $wsAccess[
'_ACCESS'] ===
'owner' || $this->
checkWorkspace(0) && !($wsAccess[
'publish_access'] & 2);
1203 if ($this->workspace > 0 && (
int)$this->workspaceRec[
'swap_modes'] === 2) {
1220 if (!is_array($config)) {
1224 $TSConf = array(
'value' => NULL,
'properties' => NULL);
1227 if (strlen($key) > 0) {
1228 if (count($parts) > 1 && strlen($parts[1]) > 0) {
1230 if (is_array($config[$key .
'.'])) {
1231 $TSConf = $this->
getTSConfig($parts[1], $config[$key .
'.']);
1234 $TSConf[
'value'] = $config[$key];
1235 $TSConf[
'properties'] = $config[$key .
'.'];
1251 return $TSConf[
'value'];
1264 return $TSConf[
'properties'];
1277 return (
string) $this->groupData[
'webmounts'] !=
'' ? explode(
',', $this->groupData[
'webmounts']) : array();
1295 $alertPopup = $this->
getTSConfig(
'options.alertPopups');
1296 if (empty($alertPopup[
'value'])) {
1300 $alertPopup = (int)$alertPopup[
'value'];
1303 return ($alertPopup & $bitmask) == $bitmask;
1318 if ($this->user[
'uid']) {
1321 $this->dataLists[
'modList'] = $this->user[
'userMods'];
1323 $this->dataLists[
'allowed_languages'] = $this->user[
'allowed_languages'];
1325 $this->dataLists[
'workspace_perms'] = $this->user[
'workspace_perms'];
1330 $this->dataLists[
'webmount_list'] = $this->user[
'db_mountpoints'];
1332 $this->dataLists[
'filemount_list'] = $this->user[
'file_mountpoints'];
1335 $this->dataLists[
'file_permissions'] = $this->user[
'file_permissions'];
1337 $this->TSdataArray[] = $this->
addTScomment(
'From $GLOBALS["TYPO3_CONF_VARS"]["BE"]["defaultUserTSconfig"]:')
1338 .
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'defaultUserTSconfig'];
1341 $this->TSdataArray[] = $this->
addTScomment(
'"admin" user presets:') .
' 1342 admPanel.enable.all = 1 1344 if (\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'sys_note')) {
1345 $this->TSdataArray[] =
' 1346 // Setting defaults for sys_note author / email... 1347 TCAdefaults.sys_note.author = ' . $this->user[
'realName'] .
' 1348 TCAdefaults.sys_note.email = ' . $this->user[
'email'] .
' 1354 if (!empty($this->user[$this->usergroup_column])) {
1357 $this->
fetchGroups($this->user[$this->usergroup_column]);
1361 $this->userGroupsUID = array_reverse(array_unique(array_reverse($this->includeGroupArray)));
1365 $this->groupList = implode(
',', $this->userGroupsUID);
1369 $this->TSdataArray[] = $this->
addTScomment(
'USER TSconfig field') . $this->user[
'TSconfig'];
1373 $this->userTS_text = implode(LF .
'[GLOBAL]' . LF, $this->TSdataArray);
1374 if (!$this->userTS_dontGetCached) {
1377 $res = $parseObj->parseTSconfig($this->userTS_text,
'userTS');
1379 $this->userTS = $res[
'TSconfig'];
1380 $this->userTSUpdated = (bool)$res[
'cached'];
1384 $hash = md5(
'userTS:' . $this->userTS_text);
1386 if (is_array($cachedContent) && !$this->userTS_dontGetCached) {
1387 $this->userTS = $cachedContent;
1390 $parseObj->parse($this->userTS_text);
1391 $this->userTS = $parseObj->setup;
1394 $this->userTSUpdated = TRUE;
1400 $this->dataLists[
'webmount_list'] =
'0,' . $this->dataLists[
'webmount_list'];
1405 $this->groupData[
'tables_select'] =
GeneralUtility::uniqueList($this->dataLists[
'tables_modify'] .
',' . $this->dataLists[
'tables_select']);
1413 $this->groupData[
'workspace_perms'] = $this->dataLists[
'workspace_perms'];
1416 if (trim($this->groupData[
'webmounts']) !==
'') {
1417 $webmounts = explode(
',', $this->groupData[
'webmounts']);
1420 $where =
'deleted=0 AND uid IN (' . $this->groupData[
'webmounts'] .
') AND ' . $this->
getPagePermsClause(1);
1421 $MProws = $this->db->exec_SELECTgetRows(
'uid',
'pages', $where,
'',
'',
'',
'uid');
1422 foreach ($webmounts as $idx => $mountPointUid) {
1424 if ($mountPointUid > 0 && !isset($MProws[$mountPointUid])) {
1425 unset($webmounts[$idx]);
1429 $this->groupData[
'webmounts'] = implode(
',', $webmounts);
1448 $lockToDomain_SQL =
' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=' . $this->db->fullQuoteStr(
GeneralUtility::getIndpEnv(
'HTTP_HOST'), $this->usergroup_table) .
')';
1449 $grList = $this->db->cleanIntList($grList);
1450 $whereSQL =
'deleted=0 AND hidden=0 AND pid=0 AND uid IN (' . $grList .
')' . $lockToDomain_SQL;
1452 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'fetchGroupQuery'])) {
1453 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'fetchGroupQuery'] as $classRef) {
1455 if (method_exists($hookObj,
'fetchGroupQuery_processQuery')) {
1456 $whereSQL = $hookObj->fetchGroupQuery_processQuery($this, $grList, $idList, $whereSQL);
1460 $res = $this->db->exec_SELECTquery(
'*', $this->usergroup_table, $whereSQL);
1462 while ($row = $this->db->sql_fetch_assoc($res)) {
1463 $this->userGroups[$row[
'uid']] = $row;
1465 $this->db->sql_free_result($res);
1467 foreach (explode(
',', $grList) as
$uid) {
1469 $row = $this->userGroups[
$uid];
1473 if (trim($row[
'subgroup'])) {
1477 $this->
fetchGroups($theList, $idList .
',' . $uid);
1480 $this->includeGroupArray[] =
$uid;
1481 $this->includeHierarchy[] = $idList;
1482 $this->TSdataArray[] = $this->
addTScomment(
'Group "' . $row[
'title'] .
'" [' . $row[
'uid'] .
'] TSconfig field:') . $row[
'TSconfig'];
1484 if (($this->user[
'options'] & 1) == 1) {
1485 $this->dataLists[
'webmount_list'] .=
',' . $row[
'db_mountpoints'];
1488 if (($this->user[
'options'] & 2) == 2) {
1489 $this->dataLists[
'filemount_list'] .=
',' . $row[
'file_mountpoints'];
1492 $this->dataLists[
'modList'] .=
',' . $row[
'groupMods'];
1493 $this->dataLists[
'tables_select'] .=
',' . $row[
'tables_select'];
1494 $this->dataLists[
'tables_modify'] .=
',' . $row[
'tables_modify'];
1495 $this->dataLists[
'pagetypes_select'] .=
',' . $row[
'pagetypes_select'];
1496 $this->dataLists[
'non_exclude_fields'] .=
',' . $row[
'non_exclude_fields'];
1497 $this->dataLists[
'explicit_allowdeny'] .=
',' . $row[
'explicit_allowdeny'];
1498 $this->dataLists[
'allowed_languages'] .=
',' . $row[
'allowed_languages'];
1499 $this->dataLists[
'custom_options'] .=
',' . $row[
'custom_options'];
1500 $this->dataLists[
'file_permissions'] .=
',' . $row[
'file_permissions'];
1502 $this->dataLists[
'workspace_perms'] |= $row[
'workspace_perms'];
1505 if ($idList ===
'' && !$this->firstMainGroup) {
1506 $this->firstMainGroup =
$uid;
1511 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'fetchGroups_postProcessing'])) {
1512 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_userauthgroup.php'][
'fetchGroups_postProcessing'] as $_funcRef) {
1532 if ((
string) $cList != (
string) $this->user[
'usergroup_cached_list']) {
1533 $this->db->exec_UPDATEquery(
'be_users',
'uid=' . (
int)$this->user[
'uid'], array(
'usergroup_cached_list' => $cList));
1543 protected function initializeFileStorages() {
1544 $this->fileStorages = array();
1549 $storageObjects = $storageRepository->findAll();
1550 foreach ($storageObjects as $storageObject) {
1551 $this->fileStorages[$storageObject->getUid()] = $storageObject;
1557 if (!array_key_exists((
int)$row[
'base'], $this->fileStorages)) {
1558 $storageObject = $storageRepository->findByUid($row[
'base']);
1559 if ($storageObject) {
1560 $this->fileStorages[$storageObject->getUid()] = $storageObject;
1577 $categoryMountPoints =
'';
1580 if (is_array($this->userGroups)) {
1581 foreach ($this->userGroups as $group) {
1582 if ($group[
'category_perms']) {
1583 $categoryMountPoints .=
',' . $group[
'category_perms'];
1589 if ($this->user[
'category_perms']) {
1590 $categoryMountPoints .=
',' . $this->user[
'category_perms'];
1595 $categoryMountPoints = array_filter($categoryMountPoints);
1596 $categoryMountPoints = array_unique($categoryMountPoints);
1598 return $categoryMountPoints;
1609 static $fileMountRecordCache = array();
1611 if (!empty($fileMountRecordCache)) {
1612 return $fileMountRecordCache;
1619 if ($this->workspace > 0 && !empty($this->workspaceRec[
'file_mountpoints'])) {
1621 $fileMounts = array_intersect($fileMounts, $workspaceFileMounts);
1624 if (!empty($fileMounts)) {
1625 $orderBy = isset(
$GLOBALS[
'TCA'][
'sys_filemounts'][
'ctrl'][
'default_sortby'])
1626 ? $this->db->stripOrderBy(
$GLOBALS[
'TCA'][
'sys_filemounts'][
'ctrl'][
'default_sortby'])
1628 $fileMountRecords = $this->db->exec_SELECTgetRows(
1633 'deleted=0 AND hidden=0 AND pid=0 AND uid IN (' . implode(
',', $fileMounts) .
')',
1637 foreach ($fileMountRecords as $fileMount) {
1638 $fileMountRecordCache[$fileMount[
'base'] . $fileMount[
'path']] = $fileMount;
1643 $readOnlyMountPoints = trim(
$GLOBALS[
'BE_USER']->
getTSConfigVal(
'options.folderTree.altElementBrowserMountPoints'));
1644 if ($readOnlyMountPoints) {
1648 $defaultStorageRow = $this->db->exec_SELECTgetSingleRow(
'uid',
'sys_file_storage', $whereClause);
1650 foreach ($readOnlyMountPointArray as $readOnlyMountPoint) {
1652 if (count($readOnlyMountPointConfiguration) === 2) {
1654 $storageUid = (int)$readOnlyMountPointConfiguration[0];
1655 $path = $readOnlyMountPointConfiguration[1];
1657 if (empty($defaultStorageRow)) {
1658 throw new \RuntimeException(
'Read only mount points have been defined in User TsConfig without specific storage, but a default storage could not be resolved.', 1404472382);
1661 $storageUid = $defaultStorageRow[
'uid'];
1662 $path = $readOnlyMountPointConfiguration[0];
1664 $fileMountRecordCache[$storageUid . $path] = array(
1665 'base' => $storageUid,
1675 if ($this->workspace <= 0 || empty($this->workspaceRec[
'file_mountpoints'])) {
1677 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'userHomePath']) {
1678 list($userHomeStorageUid, $userHomeFilter) = explode(
':',
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'userHomePath'], 2);
1679 $userHomeStorageUid = (int)$userHomeStorageUid;
1680 $userHomeFilter =
'/' . ltrim($userHomeFilter,
'/');
1681 if ($userHomeStorageUid > 0) {
1683 $path = $userHomeFilter . $this->user[
'uid'] .
'_' . $this->user[
'username'] .
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'userUploadDir'];
1684 $fileMountRecordCache[$userHomeStorageUid . $path] = array(
1685 'base' => $userHomeStorageUid,
1686 'title' => $this->user[
'username'],
1688 'read_only' => FALSE,
1689 'user_mount' => TRUE
1692 $path = $userHomeFilter . $this->user[
'uid'] .
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'userUploadDir'];
1693 $fileMountRecordCache[$userHomeStorageUid . $path] = array(
1694 'base' => $userHomeStorageUid,
1695 'title' => $this->user[
'username'],
1697 'read_only' => FALSE,
1698 'user_mount' => TRUE
1704 if ((is_array($this->user) && $this->user[
'options'] & 2) == 2 &&
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'groupHomePath'] !=
'') {
1706 list($groupHomeStorageUid, $groupHomeFilter) = explode(
':',
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'groupHomePath'], 2);
1707 $groupHomeStorageUid = (int)$groupHomeStorageUid;
1708 $groupHomeFilter =
'/' . ltrim($groupHomeFilter,
'/');
1709 if ($groupHomeStorageUid > 0) {
1711 $path = $groupHomeFilter . $groupData[
'uid'];
1712 $fileMountRecordCache[$groupHomeStorageUid . $path] = array(
1713 'base' => $groupHomeStorageUid,
1714 'title' => $groupData[
'title'],
1716 'read_only' => FALSE,
1717 'user_mount' => TRUE
1724 return $fileMountRecordCache;
1737 if ($this->fileStorages === NULL) {
1738 $this->initializeFileStorages();
1752 if ($this->uc[
'showHiddenFilesAndFolders']) {
1795 if (!isset($this->filePermissions)) {
1799 'readFile' => FALSE,
1800 'writeFile' => FALSE,
1801 'copyFile' => FALSE,
1802 'moveFile' => FALSE,
1803 'renameFile' => FALSE,
1804 'unzipFile' => FALSE,
1805 'deleteFile' => FALSE,
1807 'addFolder' => FALSE,
1808 'readFolder' => FALSE,
1809 'writeFolder' => FALSE,
1810 'copyFolder' => FALSE,
1811 'moveFolder' => FALSE,
1812 'renameFolder' => FALSE,
1813 'deleteFolder' => FALSE,
1814 'recursivedeleteFolder' => FALSE
1821 $userGroupRecordPermissions,
1828 $permissionsTsConfig = $this->
getTSConfigProp(
'permissions.file.default');
1829 if (!empty($permissionsTsConfig)) {
1831 $permissionsTsConfig,
1856 $storageFilePermissions = $this->
getTSConfigProp(
'permissions.file.storage.' . $storageObject->getUid());
1857 if (!empty($storageFilePermissions)) {
1859 $storageFilePermissions,
1860 function($value, $permission) use (&$finalUserPermissions) {
1861 $finalUserPermissions[$permission] = (bool) $value;
1866 return $finalUserPermissions;
1883 public function getDefaultUploadFolder() {
1884 $uploadFolder = $this->
getTSConfigVal(
'options.defaultUploadFolder');
1885 if ($uploadFolder) {
1889 if ($storage->isDefault() && $storage->isWritable()) {
1891 $uploadFolder = $storage->getDefaultFolder();
1892 if ($uploadFolder->checkActionPermission(
'add')) {
1895 $uploadFolder = NULL;
1896 }
catch (\
TYPO3\CMS\Core\Resource\
Exception $folderAccessException) {
1902 if (!$uploadFolder instanceof \
TYPO3\CMS\Core\Resource\Folder) {
1905 if ($storage->isWritable()) {
1907 $uploadFolder = $storage->getDefaultFolder();
1908 if ($uploadFolder->checkActionPermission(
'add')) {
1911 $uploadFolder = NULL;
1912 }
catch (\
TYPO3\CMS\Core\Resource\
Exception $folderAccessException) {
1919 if ($uploadFolder instanceof \
TYPO3\CMS\Core\Resource\Folder) {
1920 return $uploadFolder;
1935 $defaultTemporaryFolder = NULL;
1936 $defaultFolder = $this->getDefaultUploadFolder();
1938 if ($defaultFolder !== FALSE) {
1939 $tempFolderName =
'_temp_';
1940 $createFolder = !$defaultFolder->hasFolder($tempFolderName);
1941 if ($createFolder === TRUE) {
1943 $defaultTemporaryFolder = $defaultFolder->createFolder($tempFolderName);
1944 }
catch (\
TYPO3\CMS\Core\Resource\
Exception $folderAccessException) {}
1946 $defaultTemporaryFolder = $defaultFolder->getSubfolder($tempFolderName);
1950 return $defaultTemporaryFolder;
1961 $delimiter =
'# ***********************************************';
1962 $out = $delimiter . LF;
1964 foreach ($lines as $v) {
1965 $out .=
'# ' . $v . LF;
1967 $out .= $delimiter . LF;
1984 if ($allowed_languages = $this->
getTSConfigVal(
'options.workspaces.allowed_languages.' . $this->workspace)) {
1985 $this->groupData[
'allowed_languages'] = $allowed_languages;
1996 $dbMountpoints = trim($this->workspaceRec[
'db_mountpoints']);
1997 if ($this->workspace > 0 && $dbMountpoints !=
'') {
1998 $filteredDbMountpoints = array();
2008 foreach ($dbMountpoints as $mpId) {
2010 $filteredDbMountpoints[] = $mpId;
2014 $filteredDbMountpoints = array_unique($filteredDbMountpoints);
2015 $this->groupData[
'webmounts'] = implode(
',', $filteredDbMountpoints);
2027 public function checkWorkspace($wsRec, $fields =
'uid,title,adminusers,members,reviewers,publish_access,stagechg_notification') {
2030 if (!is_array($wsRec)) {
2031 switch ((
string) $wsRec) {
2033 $wsRec = array(
'uid' => $wsRec);
2036 if (\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'workspaces')) {
2037 $wsRec = $this->db->exec_SELECTgetSingleRow($fields,
2047 if (is_array($wsRec)) {
2049 return array_merge($wsRec, array(
'_ACCESS' =>
'admin'));
2051 switch ((
string) $wsRec[
'uid']) {
2053 $retVal = $this->groupData[
'workspace_perms'] & 1
2054 ? array_merge($wsRec, array(
'_ACCESS' =>
'online'))
2060 return array_merge($wsRec, array(
'_ACCESS' =>
'owner'));
2063 foreach ($this->userGroupsUID as $groupUid) {
2065 return array_merge($wsRec, array(
'_ACCESS' =>
'owner'));
2070 return array_merge($wsRec, array(
'_ACCESS' =>
'reviewer'));
2073 foreach ($this->userGroupsUID as $groupUid) {
2075 return array_merge($wsRec, array(
'_ACCESS' =>
'reviewer'));
2080 return array_merge($wsRec, array(
'_ACCESS' =>
'member'));
2083 foreach ($this->userGroupsUID as $groupUid) {
2085 return array_merge($wsRec, array(
'_ACCESS' =>
'member'));
2103 if (!isset($this->checkWorkspaceCurrent_cache)) {
2104 $this->checkWorkspaceCurrent_cache = $this->
checkWorkspace($this->workspace);
2122 $this->checkWorkspaceCurrent_cache = NULL;
2124 if ((
int)$this->workspace !== (
int)$this->user[
'workspace_id']) {
2126 $this->db->exec_UPDATEquery(
'be_users',
'uid=' . (
int)$this->user[
'uid'], array(
'workspace_id' => $this->user[
'workspace_id']));
2127 $this->
simplelog(
'User changed workspace to "' . $this->workspace .
'"');
2141 if ($workspaceRecord) {
2142 $this->workspaceRec = $workspaceRecord;
2143 $this->workspace = (int)$workspaceId;
2157 $this->workspaceRec = $this->
checkWorkspace($this->workspace,
'*');
2168 $this->user[
'workspace_preview'] = $previewState;
2169 $this->db->exec_UPDATEquery(
'be_users',
'uid=' . (
int)$this->user[
'uid'], array(
'workspace_preview' => $this->user[
'workspace_preview']));
2181 $defaultWorkspace = -99;
2182 if (!\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'workspaces') || $this->
checkWorkspace(0)) {
2184 $defaultWorkspace = 0;
2187 $defaultWorkspace = -1;
2188 } elseif (\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'workspaces')) {
2190 $workspaces = $this->db->exec_SELECTgetRows(
'uid,title,adminusers,members,reviewers',
'sys_workspace',
'pid=0' .
BackendUtility::deleteClause(
'sys_workspace'),
'',
'title');
2191 foreach ($workspaces as $rec) {
2193 $defaultWorkspace = $rec[
'uid'];
2198 return $defaultWorkspace;
2220 public function writelog($type, $action, $error, $details_nr, $details, $data, $tablename =
'', $recuid =
'', $recpid =
'', $event_pid = -1, $NEWid =
'', $userId = 0) {
2221 if (!$userId && isset($this->user[
'uid'])) {
2222 $userId = $this->user[
'uid'];
2225 $fields_values = array(
2226 'userid' => (
int)$userId,
2227 'type' => (
int)$type,
2228 'action' => (
int)$action,
2229 'error' => (
int)$error,
2230 'details_nr' => (
int)$details_nr,
2231 'details' => $details,
2232 'log_data' => serialize($data),
2233 'tablename' => $tablename,
2234 'recuid' => (
int)$recuid,
2237 'event_pid' => (
int)$event_pid,
2239 'workspace' => $this->workspace
2241 $this->db->exec_INSERTquery(
'sys_log', $fields_values);
2242 return $this->db->sql_insert_id();
2254 public function simplelog($message, $extKey =
'', $error = 0) {
2255 return $this->
writelog(4, 0, $error, 0, ($extKey ?
'[' . $extKey .
'] ' :
'') . $message, array());
2274 $theTimeBack =
$GLOBALS[
'EXEC_TIME'] - $secondsBack;
2275 $res = $this->db->exec_SELECTquery(
'tstamp',
'sys_log',
'type=255 AND action=4 AND tstamp>' . (
int)$theTimeBack,
'',
'tstamp DESC',
'1');
2276 if ($testRow = $this->db->sql_fetch_assoc($res)) {
2277 $theTimeBack = $testRow[
'tstamp'];
2279 $this->db->sql_free_result($res);
2281 $res = $this->db->exec_SELECTquery(
'*',
'sys_log',
'type=255 AND action=3 AND error<>0 AND tstamp>' . (
int)$theTimeBack,
'',
'tstamp');
2282 if ($this->db->sql_num_rows($res) > $max) {
2284 $subject =
'TYPO3 Login Failure Warning (at ' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
')';
2285 $email_body =
'There have been some attempts (' . $this->db->sql_num_rows($res) .
') to login at the TYPO3 2288 This is a dump of the failures: 2291 while ($testRows = $this->db->sql_fetch_assoc($res)) {
2292 $theData = unserialize($testRows[
'log_data']);
2293 $email_body .= date(
2294 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'ddmmyy'] .
' ' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'hhmm'],
2296 ) .
': ' . @sprintf($testRows[
'details'], (
string)$theData[0], (
string)$theData[1], (
string)$theData[2]);
2302 $mail->setTo($email)->setFrom($from)->setSubject($subject)->setBody($email_body);
2305 $this->
writelog(255, 4, 0, 3,
'Failure warning (%s failures within %s seconds) sent by email to %s', array($this->db->sql_num_rows($res), $secondsBack, $email));
2306 $this->db->sql_free_result($res);
2335 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'enabledBeUserIPLock']) {
2337 if (trim($IPList)) {
2357 if (empty($this->user[
'uid'])) {
2371 $this->emailAtLogin();
2373 throw new \RuntimeException(
'Login Error: TYPO3 is in maintenance mode at the moment. Only administrators are allowed access.', 1294585860);
2376 throw new \RuntimeException(
'Login Error: IP locking prevented you from being authorized. Can\'t proceed, sorry.', 1294585861);
2389 if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
2390 if (!$this->user[
'uid']) {
2391 if (substr(
$GLOBALS[
'MCONF'][
'name'], 0, 5) ==
'_CLI_') {
2392 $userName = strtolower(
$GLOBALS[
'MCONF'][
'name']);
2394 if ($this->user[
'uid']) {
2398 fwrite(STDERR,
'ERROR: CLI backend user "' . $userName .
'" was ADMIN which is not allowed!' . LF . LF);
2402 fwrite(STDERR,
'ERROR: No backend user named "' . $userName .
'" was found!' . LF . LF);
2406 fwrite(STDERR,
'ERROR: Module name, "' .
$GLOBALS[
'MCONF'][
'name'] .
'", was not prefixed with "_CLI_"' . LF . LF);
2410 fwrite(STDERR,
'ERROR: Another user was already loaded which is impossible in CLI mode!' . LF . LF);
2428 $temp_theSavedUC = unserialize($this->user[
'uc']);
2429 if (is_array($temp_theSavedUC)) {
2434 $originalUc = array();
2435 if (is_array($this->uc) && isset($this->uc[
'ucSetByInstallTool'])) {
2437 unset($originalUc[
'ucSetByInstallTool'], $this->uc);
2439 if (!is_array($this->uc)) {
2440 $this->uc = array_merge(
2442 (array)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'defaultUC'],
2450 if ($this->userTSUpdated) {
2455 if (!isset($this->uc[
'lang'])) {
2456 $this->uc[
'lang'] = $this->user[
'lang'];
2460 if (!isset($this->uc[
'firstLoginTimeStamp'])) {
2461 $this->uc[
'firstLoginTimeStamp'] =
$GLOBALS[
'EXEC_TIME'];
2479 $this->uc = array_merge((array) $this->uc, (array) $this->
getTSConfigProp(
'setup.override'));
2490 $this->user[
'uc'] =
'';
2502 private function emailAtLogin() {
2503 if ($this->loginSessionStarted) {
2505 $subject =
'At "' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'"' .
' from ' 2509 'User "%s" logged in from %s (%s) at "%s" (%s)',
2510 $this->user[
'username'],
2513 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'],
2517 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_email_addr']) {
2520 if ((
int)
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_mode'] & 1) {
2523 $prefix = $this->
isAdmin() ?
'[AdminLoginWarning]' :
'[LoginWarning]';
2525 if ($this->
isAdmin() && (
int)$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_mode'] & 2) {
2528 $prefix =
'[AdminLoginWarning]';
2534 $mail->setTo($GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'warning_email_addr'])->setFrom($from)->setSubject($prefix .
' ' . $subject)->setBody($msg);
2539 if ($this->uc[
'emailMeAtLogin'] && strstr($this->user[
'email'],
'@')) {
2543 $mail->setTo($this->user[
'email'])->setFrom($from)->setSubject($subject)->setBody($msg);
2561 $isUserAllowedToLogin = FALSE;
2562 $adminOnlyMode =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'adminOnly'];
2564 if (!$adminOnlyMode || $this->
isAdmin()) {
2565 $isUserAllowedToLogin = TRUE;
2566 } elseif ($adminOnlyMode == 2 && TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
2567 $isUserAllowedToLogin = TRUE;
2568 } elseif ($this->user[
'ses_backuserid']) {
2569 $backendUserId = (int)$this->user[
'ses_backuserid'];
2571 if ($this->db->exec_SELECTcountRows(
'uid',
'be_users', $whereAdmin) > 0) {
2572 $isUserAllowedToLogin = TRUE;
2575 return $isUserAllowedToLogin;
static uniqueList($in_list, $secondParameter=NULL)
static getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields=' *')
setWorkspace($workspaceId)
checkWorkspace($wsRec, $fields='uid, title, adminusers, members, reviewers, publish_access, stagechg_notification')
writelog($type, $action, $error, $details_nr, $details, $data, $tablename='', $recuid='', $recpid='', $event_pid=-1, $NEWid='', $userId=0)
setTemporaryWorkspace($workspaceId)
static getRecordsByField($theTable, $theField, $theValue, $whereClause='', $groupBy='', $orderBy='', $limit='', $useDeleteClause=TRUE)
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
static setShowHiddenFilesAndFolders($showHiddenFilesAndFolders)
isPSet($compiledPermissions, $tableName, $actionType='')
workspaceCannotEditOfflineVersion($table, $recData)
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
checkLogFailures($email, $secondsBack, $maxFailures)
static getIndpEnv($getEnvName)
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
setWorkspacePreview($previewState)
workspaceCreateNewRecord($pid, $table)
simplelog($message, $extKey='', $error=0)
static makeInstance($className)
static storeHash($hash, $data, $ident)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
checkAuthMode($table, $field, $value, $authMode)
const TYPO3_PROCEED_IF_NO_USER
recordEditAccessInternals($table, $idOrRow, $newRecord=FALSE, $deletedRecord=FALSE, $checkFullLanguageAccess=FALSE)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
$checkWorkspaceCurrent_cache
workspaceCheckStageForCurrent($stage)
static cmpIP($baseIP, $list)
workspacePublishAccess($wsid)
getTSConfig($objectString, $config='')
static deprecationLog($msg)
workspaceAllowLiveRecordsInPID($pid, $table)
static checkIncludeLines_array(array $array)
workspaceCannotEditRecord($table, $recData)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
getTSConfigVal($objectString)
modAccess($conf, $exitOnError)
getPagePermsClause($perms)
fetchGroups($grList, $idList='')
isInWebMount($id, $readPerms='', $exitOnError=0)
checkLanguageAccess($langValue)
static removeDotsFromTS(array $ts)
isMemberOfGroup($groupId)
static isModuleSetInTBE_MODULES($modName)
checkFullLanguagesAccess($table, $record)
evaluateUserSpecificFileFilterSettings()
initializeDbMountpointsInWorkspace()
static redirect($url, $httpStatus=self::HTTP_STATUS_303)
getFilePermissionsForStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
static getHash($hash, $expTime=0)
doesUserHaveAccess($row, $perms)
workspaceAllowAutoCreation($table, $id, $recpid)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
static isTableLocalizable($table)
getTSConfigProp($objectString)
static BEenableFields($table, $inv=0)
static deleteClause($table, $tableAlias='')
getDefaultUploadTemporaryFolder()