mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 45748 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.1.0-rc3oriwave2 ........ r45748 | sminnee | 2007-11-27 17:45:11 +1300 (Tue, 27 Nov 2007) | 1 line Create Group::canEdit(), which can be used to filter the SecurityAdmin group list ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@49790 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
84d1d57df5
commit
03e67fe100
@ -177,6 +177,26 @@ class Group extends DataObject {
|
|||||||
$this->setCode($this->Title);
|
$this->setCode($this->Title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canEdit() {
|
||||||
|
if($this->hasMethod('alternateCanEdit')) return $this->alternateCanEdit();
|
||||||
|
else return Member::currentUserID() ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all of the children for the CMS Tree.
|
||||||
|
* Filters to only those groups that the current user can edit
|
||||||
|
*/
|
||||||
|
function AllChildrenIncludingDeleted() {
|
||||||
|
$children = $this->extInstance('Hierarchy')->AllChildrenIncludingDeleted();
|
||||||
|
$filteredChildren = new DataObjectSet();
|
||||||
|
|
||||||
|
foreach($children as $child) {
|
||||||
|
if($child->canEdit()) $filteredChildren->push($child);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filteredChildren;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user