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).

This commit is contained in:
Simon Welsh 2011-10-29 12:09:22 +13:00
parent 1eab669f9b
commit 58bbb3687a

View File

@ -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 {