Project

General

Profile

Bug #21923 » 13170_v2.patch

Administrator Admin, 2010-03-29 00:54

View differences:

t3lib/class.t3lib_userauthgroup.php (working copy)
break;
default:
// Checking if the guy is admin:
if (t3lib_div::inList($wsRec['adminusers'],$this->user['uid'])) {
if (t3lib_div::inList($wsRec['adminusers'],'be_users_'.$this->user['uid'])) {
return array_merge($wsRec, array('_ACCESS' => 'owner'));
}
// Checking if he is owner through a user group of his:
foreach($this->userGroupsUID as $groupUid) {
if (t3lib_div::inList($wsRec['adminusers'],'be_groups_'.$groupUid)) {
return array_merge($wsRec, array('_ACCESS' => 'owner'));
}
}
// Checking if he is reviewer user:
if (t3lib_div::inList($wsRec['reviewers'],'be_users_'.$this->user['uid'])) {
return array_merge($wsRec, array('_ACCESS' => 'reviewer'));
t3lib/stddb/tables.sql (working copy)
deleted tinyint(1) DEFAULT '0' NOT NULL,
title varchar(30) DEFAULT '' NOT NULL,
description varchar(255) DEFAULT '' NOT NULL,
adminusers varchar(255) DEFAULT '' NOT NULL,
adminusers text,
members text,
reviewers text,
db_mountpoints varchar(255) DEFAULT '' NOT NULL,
typo3/sysext/install/ext_localconf.php (working copy)
// if needed, sysext statictables is loaded, which gives back functionality
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['checkForStaticTypoScriptTemplates'] = 'tx_coreupdates_statictemplates';
?>
// upgrade sys_workspace:adminusers field TYPO3 4.4
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['workspaceAdmin'] = 'tx_coreupdates_workspaceadmin';
?>
typo3/sysext/install/mod/class.tx_install.php (working copy)
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installnewsysexts.php');
require_once(t3lib_extMgm::extPath('install') . 'mod/class.tx_install_session.php');
require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_statictemplates.php');
require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_workspaceadmin.php');
/**
* Install Tool module
typo3/sysext/install/updates/class.tx_coreupdates_workspaceadmin.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Tolleiv Nietsch <nietsch@aoemedia.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contains the update class for the admin field of sys_workspace
*
* @author Tolleiv Nietsch <nietsch@aoemedia.de>
*/
class tx_coreupdates_workspaceadmin {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
/**
* Checks if an update is needed
*
* @param string &$description: The description for the update
* @return boolean whether an update is needed (true) or not (false)
*/
public function checkForUpdate(&$description) {
$result = false;
$description = 'Upgrades the "adminusers" field of the workspaces, to support references to be_groups and be_users side by side.';
if ($this->versionNumber >= 4004000) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid',
'sys_workspace',
'adminusers > \'\' AND adminusers NOT LIKE \'%be_users%\' AND adminusers NOT LIKE \'%be_groups\%\'',
'',
'',
'1'
);
if($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
$result = true;
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
return $result;
}
/**
* Performs the database update. Changes the values of adminusers to be prefixed with the tablename
*
* @param array &$dbQueries: queries done in this update
* @param mixed &$customMessages: custom messages
* @return boolean whether it worked (true) or not (false)
*/
public function performUpdate(&$dbQueries, &$customMessages) {
$result = false;
if($this->versionNumber >= 4004000) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,adminusers',
'sys_workspace',
'adminusers > \'\' AND adminusers NOT LIKE \'%be_users%\' AND adminusers NOT LIKE \'%be_groups\%\'',
'',
'',
'1'
);
if ($GLOBALS['TYPO3_DB']->sql_error()) {
$customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
} else {
$result = true;
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$updateArray = array(
'adminusers' => 'be_users_' . implode(',be_users_', t3lib_div::trimExplode(',', $row['adminusers'])),
);
$resUp = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
'sys_workspace',
'uid = \'' . $row['uid'] . '\'',
$updateArray
);
$dbQueries[] = str_replace(chr(10), ' ', $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery);
if ($GLOBALS['TYPO3_DB']->sql_error()) {
$customMessages = 'SQL-ERROR: ' . htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error());
$result = false;
}
}
}
}
return $result;
}
}
?>
typo3/sysext/version/tca.php (working copy)
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'be_users',
'allowed' => 'be_users,be_groups',
'prepend_tname' => 1,
'size' => '3',
'maxitems' => '10',
'autoSizeMax' => 10,
(2-2/3)