Feature #17766 ยป LimitedListViewBEuser_v1_(trunk).patch
typo3/class.db_list_extra.inc (working copy) | ||
---|---|---|
$selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA!
|
||
$selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement.
|
||
|
||
// Adding Limits for List
|
||
$addWhere.= $this->getLimits($id,$table,$TCA[$table]['ctrl']['cruser_id']);
|
||
|
||
// Create the SQL query for selecting the elements in the listing:
|
||
$queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc)
|
||
$this->setTotalItems($queryParts); // Finding the total amount of records on the page (API function from class.db_list.inc)
|
||
... | ... | |
// Exits:
|
||
exit;
|
||
}
|
||
|
||
function getLimits($id,$table,$cruser_id) {
|
||
if ($GLOBALS['BE_USER']->isAdmin()) {
|
||
return '';
|
||
}
|
||
|
||
$pageTS = t3lib_beFunc::getPagesTSconfig($id, true);
|
||
$pageTS = $pageTS['mod.']['web_list.']['list.'][$table.'.'];
|
||
|
||
//pageTS
|
||
// checking groups
|
||
if (isset($pageTS['groupsAll']) || isset($pageTS['groupsLimited'])) {
|
||
$limit = false;
|
||
|
||
$groupsAll = t3lib_div::trimExplode(',',$pageTS['groupsAll']);
|
||
if (count($tsCfg['groupsAll']) > 0) {
|
||
$limit = true;
|
||
foreach ($groupsAll AS $groupId) {
|
||
if ($GLOBALS['BE_USER']->isMemberOfGroup($groupId)) {
|
||
return '';
|
||
}
|
||
}
|
||
}else {
|
||
$groupsLimited = t3lib_div::trimExplode(',',$pageTS['groupsLimited']);
|
||
foreach ($groupsLimited AS $groupId) {
|
||
if ($GLOBALS['BE_USER']->isMemberOfGroup($groupId)) {
|
||
$limit = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if ($limit) {
|
||
return ' AND '.$cruser_id.' = '.$GLOBALS['BE_USER']->user['uid'].' ';
|
||
}
|
||
return '';
|
||
}
|
||
|
||
// UserTS
|
||
$userTS = $GLOBALS['BE_USER']->getTSConfigProp('mod.web_list.list.'.$table);
|
||
// checking pages
|
||
if (isset($userTS['pagesAll']) || isset($userTS['pagesLimited'])) {
|
||
$pagesAll = t3lib_div::trimExplode(',',$userTS['pagesAll']);
|
||
if (in_array($id,$pagesAll) || in_array('all',$pagesAll)) {
|
||
return '';
|
||
}
|
||
|
||
$pagesLimited = t3lib_div::trimExplode(',',$userTS['pagesLimited']);
|
||
if (in_array($id,$pagesLimited) || in_array('all',$pagesLimited)) {
|
||
return ' AND '.$cruser_id.' = '.$GLOBALS['BE_USER']->user['uid'].' ';
|
||
}
|
||
}
|
||
return '';
|
||
}
|
||
}
|
||
|
||
|
||
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
|
||
}
|