mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
1eab669f9b
commit
58bbb3687a
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user