summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-08-29 12:24:44 -0700
committerBharat Mediratta <bharat@menalto.com>2009-08-29 12:24:44 -0700
commit6b633e87489acbe79d65fc5e089d35cc27ee691c (patch)
tree6a8a8bdddd27f5f39f76d9aea080d6112e7eea1d /modules/gallery/models
parent35f83ff31d8422e56c417ac761272168a97c8546 (diff)
parentcd1fd4989f394f6e8084b8101a8dbdb3030c52aa (diff)
Merge branch 'talmdal_branch' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php34
1 files changed, 1 insertions, 33 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 7a3a2ba7..68e89db6 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -19,7 +19,6 @@
*/
class Item_Model extends ORM_MPTT {
protected $children = 'items';
- private $view_restrictions = null;
protected $sorting = array();
var $rules = array(
@@ -34,38 +33,7 @@ class Item_Model extends ORM_MPTT {
* @chainable
*/
public function viewable() {
- if (is_null($this->view_restrictions)) {
- if (user::active()->admin) {
- $this->view_restrictions = array();
- } else {
- foreach (user::group_ids() as $id) {
- // Separate the first restriction from the rest to make it easier for us to formulate
- // our where clause below
- if (empty($this->view_restrictions)) {
- $this->view_restrictions[0] = "view_$id";
- } else {
- $this->view_restrictions[1]["view_$id"] = access::ALLOW;
- }
- }
- }
- }
- switch (count($this->view_restrictions)) {
- case 0:
- break;
-
- case 1:
- $this->where($this->view_restrictions[0], access::ALLOW);
- break;
-
- default:
- $this->open_paren();
- $this->where($this->view_restrictions[0], access::ALLOW);
- $this->orwhere($this->view_restrictions[1]);
- $this->close_paren();
- break;
- }
-
- return $this;
+ return item::viewable($this);
}
/**