diff options
| author | jhilden <jakobhilden@gmail.com> | 2009-08-29 19:12:57 -0400 |
|---|---|---|
| committer | jhilden <jakobhilden@gmail.com> | 2009-08-29 19:12:57 -0400 |
| commit | ed9be096535dfbac4d62e0cc74f416a71f67648d (patch) | |
| tree | 3301809705b4418b97673d8f006332111b42fa5f /modules/gallery/models | |
| parent | 39559fdfd09491dce669d0351768fe2b13ccdd03 (diff) | |
| parent | 0aceba6f48e5542d3edfbb1f195af50187adbac4 (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 34 |
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); } /** |
