mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Ticket #5578 SiteTree->CanCreateTopLevel() doesn't change dragged tree nodes or ParentID changes
This commit is contained in:
parent
e23a7585a7
commit
882b4267cb
@ -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();
|
||||
|
@ -93,6 +93,11 @@
|
||||
ID: $(movedNode).data('id'),
|
||||
ParentID: $(newParentNode).data('id') || 0,
|
||||
SiblingIDs: siblingIDs
|
||||
},
|
||||
statusCode: {
|
||||
403: function() {
|
||||
$.jstree.rollback(data.rlbk);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user