Ensure SiteConfig::canView

This commit is contained in:
Damian Mooyman 2015-03-19 16:16:54 +13:00
parent 3df41e1176
commit a84361e4e8

View File

@ -239,6 +239,23 @@ class SiteConfig extends DataObject implements PermissionProvider, TemplateGloba
return $config;
}
/**
* Can a user view this SiteConfig instance?
*
* @param Member $member
* @return boolean
*/
public function canView($member = null) {
if(!$member) $member = Member::currentUserID();
if($member && is_numeric($member)) $member = DataObject::get_by_id('Member', $member);
$extended = $this->extendedCan('canView', $member);
if($extended !== null) return $extended;
// Assuming all that can edit this object can also view it
return $this->canEdit($member);
}
/**
* Can a user view pages on this site? This method is only
* called if a page is set to Inherit, but there is nothing