diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-07-17 08:14:08 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-07-17 08:14:08 -0700 |
commit | 8a6556b30bc34d69284df6246f4010a8835f3bc2 (patch) | |
tree | 7d0b5374bba65973c2231083bc5d93ad31f4ccfc /modules/gallery/helpers/access.php | |
parent | 0f766b149d0cee7af664f2321fddc6f04cda70ac (diff) |
Fix a bug where moved items don't properly inherit permissions from
their new target. After each move, recalculate the permissions for
the new parent's hierarchy.
Fixes ticket #552
Diffstat (limited to 'modules/gallery/helpers/access.php')
-rw-r--r-- | modules/gallery/helpers/access.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index c48f0b79..5dd1e465 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -244,6 +244,21 @@ class access_Core { } /** + * Recalculate the permissions for a given item and its hierarchy. $item must be an album. + */ + static function recalculate_permissions($item) { + foreach (self::_get_all_groups() as $group) { + foreach (ORM::factory("permission")->find_all() as $perm) { + if ($perm->name == "view") { + self::_update_access_view_cache($group, $item); + } else { + self::_update_access_non_view_cache($group, $perm->name, $item); + } + } + } + } + + /** * Register a permission so that modules can use it. * * @param string $name The internal name for for this permission |