Update GridFieldOrderableRows.php

If it's a many many relationship, then it should be based on View not edit, as the sort field will be on the relationship using many_many_extraFields. Plus the view permission allows the user to create a many relationship, so it should allow editing of the relationship.
This commit is contained in:
John Milmine 2014-05-08 14:13:17 +12:00
parent 45eb7954a6
commit 0e424821a8

View File

@ -138,7 +138,9 @@ class GridFieldOrderableRows extends RequestHandler implements
* Handles requests to reorder a set of IDs in a specific order. * Handles requests to reorder a set of IDs in a specific order.
*/ */
public function handleReorder($grid, $request) { public function handleReorder($grid, $request) {
if(!singleton($grid->getModelClass())->canEdit()) { if (is_a($grid->getList(), 'ManyManyList') && !singleton($grid->getModelClass())->canView()) {
$this->httpError(403);
} else if(!is_a($grid->getList(), 'ManyManyList') && !singleton($grid->getModelClass())->canEdit()) {
$this->httpError(403); $this->httpError(403);
} }