From 58bbb3687ac70ed730d4b7690a5fefcb06c0dae2 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Sat, 29 Oct 2011 12:09:22 +1300 Subject: [PATCH] Change Controller::can() to allow an array of perms, as CMSMain can pass an array in (singleton($class)->stat('need_permission') can be an array). --- control/Controller.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/control/Controller.php b/control/Controller.php index f39e8a14d..3f4f92dda 100644 --- a/control/Controller.php +++ b/control/Controller.php @@ -368,6 +368,10 @@ class Controller extends RequestHandler { */ function can($perm, $member = null) { if(!$member) $member = Member::currentUser(); + if(is_array($perm)) { + $perm = array_map(array($this, 'can'), $perm, array_fill(0, count($perm), $member)); + return min($perm); + } if($this->hasMethod($methodName = 'can' . $perm)) { return $this->$methodName($member); } else {