BUGFIX: Ticket #5578 SiteTree->CanCreateTopLevel() doesn't change dragged tree nodes or ParentID changes

This commit is contained in:
Paul Meyrick 2012-06-14 17:17:27 +12:00
parent e23a7585a7
commit 882b4267cb
2 changed files with 17 additions and 0 deletions

View File

@ -793,6 +793,18 @@ class LeftAndMain extends Controller implements PermissionProvider {
$statusUpdates = array('modified'=>array());
$id = $request->requestVar('ID');
$parentID = $request->requestVar('ParentID');
if($className == 'SiteTree' && $page = DataObject::get_by_id('Page', $id)){
$root = $page->getParentType();
if(($parentID == '0' || $root == 'root') && !SiteConfig::current_site_config()->canCreateTopLevel()){
$this->response->setStatusCode(
403,
_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to alter Top level pages. Your change was not saved.")
);
return;
}
}
$siblingIDs = $request->requestVar('SiblingIDs');
$statusUpdates = array('modified'=>array());
if(!is_numeric($id) || !is_numeric($parentID)) throw new InvalidArgumentException();

View File

@ -93,6 +93,11 @@
ID: $(movedNode).data('id'),
ParentID: $(newParentNode).data('id') || 0,
SiblingIDs: siblingIDs
},
statusCode: {
403: function() {
$.jstree.rollback(data.rlbk);
}
}
});
});