Hello MODxers,
if I understand right, setting
checkListPermission = true, a GetListProcessor should skip rows the user isn't entitled to view. Why doesn't this work as expected in my GetListProcessor below (in my case the processor returns custom resource documents)?
The processor falsely returns also rows from other contexts where the user has not access to!
The MODx error log shows these messages:
[2013-06-21 08:35:09] (INFO @ /connectors/resource/index.php) Principal 10 does not have permission to load object of class modContext with primary key: web2
[2013-06-21 08:35:09] (INFO @ /connectors/resource/index.php) Principal 10 does not have permission to load object of class modContext with primary key: web3
[2013-06-21 08:35:16] (INFO @ /connectors/resource/index.php) Principal 10 does not have permission to load object of class modContext with primary key: web2
[2013-06-21 08:35:16] (INFO @ /connectors/resource/index.php) Principal 10 does not have permission to load object of class modContext with primary key: web3
Here is the list processor:
class ResourceContainerGetListProcessor extends modObjectGetListProcessor {
public $classKey = 'GoodNewsResourceContainer';
public $languageTopics = array('goodnews:default');
public $checkListPermission = true;
public $defaultSortField = 'pagetitle';
public $defaultSortDirection = 'ASC';
public function prepareQueryBeforeCount(xPDOQuery $c) {
$columns = array(
'id',
'pagetitle',
'class_key',
'context_key',
);
$c->select($this->modx->getSelectColumns('GoodNewsResourceContainer', 'GoodNewsResourceContainer', '', $columns));
$c->where(array('class_key' => 'GoodNewsResourceContainer'));
$c->where(array('published' => 1));
$c->where(array('deleted' => 0));
return $c;
}
public function prepareRow(xPDOObject $object) {
$resourceArray = parent::prepareRow($object);
$charset = $this->modx->getOption('modx_charset', null, 'UTF-8');
$resourceArray['pagetitle'] = htmlentities($resourceArray['pagetitle'], ENT_COMPAT, $charset);
$resourceArray['name'] = $resourceArray['pagetitle'].' ('.$resourceArray['context_key'].')';
return $resourceArray;
}
}
return 'ResourceContainerGetListProcessor';
[ed. note: gadgetto last edited this post 12 years, 6 months ago.]