From f533aee1cc71e8db739406859ac0cf43dce030ec Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 21 Jul 2009 15:52:46 -0700 Subject: Add an API method user_can that allows for checking a specific user has the specified permission to the item. Changed can to delegate to this method passing in the active user. --- modules/gallery/helpers/access.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers/access.php') diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 63324e5d..224b51e0 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -78,11 +78,23 @@ class access_Core { * @return boolean */ static function can($perm_name, $item) { + return self::user_can(user::active(), $perm_name, $item); + } + + /** + * Does the user have this permission on this item? + * + * @param User_Model $user + * @param string $perm_name + * @param Item_Model $item + * @return boolean + */ + static function user_can($user, $perm_name, $item) { if (!$item->loaded) { return false; } - if (user::active()->admin) { + if ($user->admin) { return true; } -- cgit v1.2.3