mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API CHANGE: Added canView() to CMSBatchAction so that you could hide certain batch actions from some users. (from r94846) (from r96823)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102687 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
186e43e60b
commit
4d0362ba64
@ -116,6 +116,13 @@ abstract class CMSBatchAction extends Object {
|
||||
function getParameterFields() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you wish to restrict the batch action to some users, overload this function.
|
||||
*/
|
||||
function canView() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,11 +126,13 @@ class CMSBatchActionHandler extends RequestHandler {
|
||||
foreach($actions as $urlSegment => $action) {
|
||||
$actionClass = $action['class'];
|
||||
$actionObj = new $actionClass();
|
||||
$actionDef = new ArrayData(array(
|
||||
"Link" => Controller::join_links($this->Link(), $urlSegment),
|
||||
"Title" => $actionObj->getActionTitle()
|
||||
));
|
||||
$actionList->push($actionDef);
|
||||
if($actionObj->canView()) {
|
||||
$actionDef = new ArrayData(array(
|
||||
"Link" => Controller::join_links($this->Link(), $urlSegment),
|
||||
"Title" => $actionObj->getActionTitle()
|
||||
));
|
||||
$actionList->push($actionDef);
|
||||
}
|
||||
}
|
||||
|
||||
return $actionList;
|
||||
|
Loading…
Reference in New Issue
Block a user