mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
01e715212c
commit
a213550372
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user