Prepared auth filters. Auth part still missing

This commit is contained in:
Thomas Gelf 2013-08-21 00:25:43 +02:00 committed by Eric Lippmann
parent ecaa12b0f4
commit 0ffef655df
1 changed files with 15 additions and 1 deletions

View File

@ -89,6 +89,16 @@ class AbstractView extends AbstractQuery
*/
protected $sortDefaults = array();
/**
* Filters that will be enforced (e.g. AND for SQL), will be used for auth
* restrictions
*
* TODO: rename to enforcedFilters?
*
* @var Array
*/
protected $forcedFilters = array();
/**
* Whether this view provides a specific column name
*
@ -184,7 +194,8 @@ class AbstractView extends AbstractQuery
// TODO: applyAuthFilters(Auth $auth = null)
// AbstractView will enforce restrictions as provided by the Auth
// backend
// backend. Those filters work like normal ones and have to be stored
// by applyAuthFilters to $this->forcedFilters
/**
* Apply an array of filters. This might become obsolete or even improved
@ -269,6 +280,9 @@ class AbstractView extends AbstractQuery
foreach ($this->filters as $f) {
$query->where($f[0], $f[1]);
}
foreach ($this->forcedFilters as $col => $filter) {
$query->where($col, $filter);
}
foreach ($this->order_columns as $col) {
if (isset($this->sortDefaults[$col[0]]['columns'])) {