diff options
author | Bharat Mediratta <bharat@menalto.com> | 2013-01-23 18:24:31 -0500 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2013-01-23 18:24:31 -0500 |
commit | 9ba9f3953132c5c5de9efb0a4724c7b9300dc9ea (patch) | |
tree | 4360e6154895c58144a9a03e3081f4d2650d479c /modules/gallery/models | |
parent | 31807a59a5160a816718fbea1b1659398a2110bb (diff) |
Add a "can_add" permission bit similar to the "can_edit" bit to the RESTful array
representation of Item_Model. Fixes #1903.
Diffstat (limited to 'modules/gallery/models')
-rw-r--r-- | modules/gallery/models/item.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 85aca2c1..bbfeee47 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -663,7 +663,7 @@ class Item_Model_Core extends ORM_MPTT { } /** - * Return a view for movies. By default this is a Flowplayer v3 <script> tag, but + * Return a view for movies. By default this is a Flowplayer v3 <script> tag, but * movie_img events can override this and provide their own player/view. If no player/view * is found and the movie is unsupported by Flowplayer v3, this returns a simple download link. * @param array $extra_attrs @@ -675,12 +675,12 @@ class Item_Model_Core extends ORM_MPTT { $height = $this->height; if ($width == 0 || $height == 0) { // Not set correctly, likely because ffmpeg isn't available. Making the window 0x0 causes the - // video to be effectively unviewable. So, let's guess: set width to max_size and guess a - // height (using 4:3 aspect ratio). Once the video metadata is loaded, js in + // video to be effectively unviewable. So, let's guess: set width to max_size and guess a + // height (using 4:3 aspect ratio). Once the video metadata is loaded, js in // movieplayer.html.php will correct these values. $width = $max_size; $height = ceil($width * 3/4); - } + } $attrs = array_merge(array("id" => "g-item-id-{$this->id}"), $extra_attrs, array("class" => "g-movie")); @@ -1073,6 +1073,10 @@ class Item_Model_Core extends ORM_MPTT { $data["can_edit"] = access::can("edit", $this); } + if (empty($fields) || isset($fields["can_add"])) { + $data["can_add"] = access::can("add", $this); + } + // Elide some internal-only data that is going to cause confusion in the client. foreach (array("relative_path_cache", "relative_url_cache", "left_ptr", "right_ptr", "thumb_dirty", "resize_dirty", "weight") as $key) { |