APICHANGE: add Group::canView() so that give group object a different level of security control.

FEATURE: CRM Security with two levels: viewable and writeable.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70697 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-01-23 05:38:24 +00:00 committed by Sam Minnee
parent 01e715212c
commit a213550372

View File

@ -278,6 +278,14 @@ class Group extends DataObject {
|| (Member::currentUserID() && !DataObject::get("Permission", "GroupID = $this->ID AND Code = 'ADMIN'"));
}
}
public function canView() {
if($this->hasMethod('alternateCanView')) return $this->alternateCanView();
else {
return Permission::check("ADMIN")
|| (Member::currentUserID() && !DataObject::get("Permission", "GroupID = $this->ID AND Code = 'ADMIN'"));
}
}
/**
* Returns all of the children for the CMS Tree.
@ -288,7 +296,7 @@ class Group extends DataObject {
$filteredChildren = new DataObjectSet();
if($children) foreach($children as $child) {
if($child->canEdit()) $filteredChildren->push($child);
if($child->can()) $filteredChildren->push($child);
}
return $filteredChildren;