Project

General

Profile

Bug #15425 » 0002278_v4.patch

Administrator Admin, 2009-09-17 21:21

View differences:

t3lib/interfaces/interface.t3lib_tcemain_checkmodifyaccesslisthook.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Oliver Hader <oliver@typo3.org>
* 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!
***************************************************************/
/**
* Interface for hook in t3lib_TCEmain::checkModifyAccessList
*
* @author Oliver Hader <oliver@typo3.org>
* @package TYPO3
* @subpackage t3lib
*/
interface t3lib_TCEmain_checkModifyAccessListHook {
/**
* Hook that determines whether a user has access to modify a table.
*
* @param boolean &$accessAllowed: Whether the user has access to modify a table
* @param string $table: The name of the table to be modified
* @param t3lib_TCEmain $parent: The calling parent object
* @return void
*/
public function checkModifyAccessList(&$accessAllowed, $table, t3lib_TCEmain $parent);
}
?>
t3lib/core_autoload.php (Arbeitskopie)
't3lib_localrecordlistgettablehook' => PATH_t3lib . 'interfaces/interface.t3lib_localrecordlistgettablehook.php',
't3lib_singleton' => PATH_t3lib . 'interfaces/interface.t3lib_singleton.php',
't3lib_tceformsinlinehook' => PATH_t3lib . 'interfaces/interface.t3lib_tceformsinlinehook.php',
't3lib_tcemain_checkmodifyaccesslisthook' => PATH_t3lib . 'interfaces/interface.t3lib_tcemain_checkmodifyaccesslisthook.php',
't3lib_utility_client' => PATH_t3lib . 'utility/class.t3lib_utility_client.php',
'tslib_adminpanel' => PATH_tslib . 'class.tslib_adminpanel.php',
'tslib_cobj' => PATH_tslib . 'class.tslib_content.php',
t3lib/class.t3lib_tcemain.php (Arbeitskopie)
var $autoVersioningUpdate = FALSE; // A signal flag used to tell file processing that autoversioning has happend and hence certain action should be applied.
protected $disableDeleteClause = false; // Disable delete clause
protected $checkModifyAccessListHookObjects;
......
}
}
/**
* Gets the 'checkModifyAccessList' hook objects.
* The first call initializes the accordant objects.
*
* @return array The 'checkModifyAccessList' hook objects (if any)
*/
protected function getCheckModifyAccessListHookObjects() {
if (!isset($this->checkModifyAccessListHookObjects)) {
$this->checkModifyAccessListHookObjects = array();
if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'])) {
foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $classData) {
$hookObject = t3lib_div::getUserObj($classData);
if(!($hookObject instanceof t3lib_TCEmain_checkModifyAccessListHook)) {
throw new UnexpectedValueException('$hookObject must implement interface t3lib_TCEmain_checkModifyAccessListHook', 1251892472);
}
$this->checkModifyAccessListHookObjects[] = $hookObject;
}
}
}
return $this->checkModifyAccessListHookObjects;
}
......
/*********************************************
*
* PROCESSING DATA
......
*/
function checkModifyAccessList($table) {
$res = ($this->admin || (!$this->tableAdminOnly($table) && t3lib_div::inList($this->BE_USER->groupData['tables_modify'],$table)));
// Hook 'checkModifyAccessList': Post-processing of the state of access
foreach($this->getCheckModifyAccessListHookObjects() as $hookObject) {
/* @var $hookObject t3lib_TCEmain_checkModifyAccessListHook */
$hookObject->checkModifyAccessList($res, $table, $this);
}
return $res;
}
(6-6/6)