diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-31 04:05:41 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-31 04:05:41 +0000 |
commit | 1579494ec4acb80e103a40106aea1630628c00d2 (patch) | |
tree | 04f7215f225a19beea90ea9a7b8bbde2d37593ec /core/models | |
parent | 246139cf1f8a439a85c310252bdeb1497d56a7cf (diff) |
Preliminary "Edit Permissions" dialog. You can't change permissions
yet, but it shows you which items have locked view perms.
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/item.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/models/item.php b/core/models/item.php index a21aaf16..a419c2f1 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -20,7 +20,7 @@ class Item_Model extends ORM_MPTT { protected $children = 'items'; private $relative_path = null; - private $view_restrictions = array(); + private $view_restrictions = null; var $rules = array( "name" => "required|length[0,255]", @@ -34,9 +34,13 @@ class Item_Model extends ORM_MPTT { * @chainable */ public function viewable() { - if (empty($this->view_restrictions)) { - foreach (user::group_ids() as $id) { - $this->view_restrictions["view_$id"] = access::ALLOW; + if (is_null($this->view_restrictions)) { + if (user::active()->admin) { + $this->view_restrictions = array(); + } else { + foreach (user::group_ids() as $id) { + $this->view_restrictions["view_$id"] = access::ALLOW; + } } } $this->where($this->view_restrictions); |