ENHANCEMENT added new permission, SITETREE_REORGANISE

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@84073 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-08-09 22:29:45 +00:00
parent 2d97200a23
commit 96d438f21e
2 changed files with 16 additions and 1 deletions

View File

@ -891,6 +891,11 @@ JS;
} }
$_REQUEST['ajax'] = 1; $_REQUEST['ajax'] = 1;
$cleanupJS = ''; $cleanupJS = '';
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
FormResponse::status_message(_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to rearange the site tree. Your change was not saved."),"bad");
return FormResponse::respond();
}
if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) { if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) {
$node = DataObject::get_by_id($this->stat('tree_class'), $id); $node = DataObject::get_by_id($this->stat('tree_class'), $id);
@ -932,6 +937,11 @@ JS;
$counter = 0; $counter = 0;
$js = ''; $js = '';
$_REQUEST['ajax'] = 1; $_REQUEST['ajax'] = 1;
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
FormResponse::status_message(_t('LeftAndMain.CANT_REORGANISE',"You do not have permission to rearange the site tree. Your change was not saved."),"bad");
return FormResponse::respond();
}
if(is_array($_REQUEST['ID'])) { if(is_array($_REQUEST['ID'])) {
if($_REQUEST['MovedNodeID']==0){ //Sorting root if($_REQUEST['MovedNodeID']==0){ //Sorting root
@ -970,6 +980,10 @@ JS;
return FormResponse::respond(); return FormResponse::respond();
} }
public function CanOrganiseSitetree() {
return !Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN') ? false : true;
}
/** /**
* Delete a number of items * Delete a number of items

View File

@ -88,6 +88,7 @@
<% end_control %> <% end_control %>
</select> <img id="siteTreeFilterActionIndicator" style="display:none" src="cms/images/network-save.gif"> </select> <img id="siteTreeFilterActionIndicator" style="display:none" src="cms/images/network-save.gif">
</div> </div>
<% if CanOrganiseSitetree %>
<div class="checkboxAboveTree"> <div class="checkboxAboveTree">
<img id="checkboxActionIndicator" src="cms/images/network-save.gif"> <img id="checkboxActionIndicator" src="cms/images/network-save.gif">
<div> <div>
@ -95,7 +96,7 @@
<label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label>
</div> </div>
</div> </div>
<% end_if %>
<% if IsTranslatableEnabled %> <% if IsTranslatableEnabled %>
<div id="LangSelector_holder"> <div id="LangSelector_holder">
Language: $LangSelector Language: $LangSelector