mirror of
https://github.com/silverstripe/silverstripe-restfulserver
synced 2024-10-22 14:05:58 +02:00
FIX: add missing canView check in json
This commit is contained in:
parent
bb000254af
commit
d0149f8995
@ -106,6 +106,9 @@ class JSONDataFormatter extends DataFormatter
|
||||
if ($this->customRelations && !in_array($relName, $this->customRelations)) {
|
||||
continue;
|
||||
}
|
||||
if ($obj->$relName() && (!$obj->$relName()->exists() || !$obj->$relName()->canView())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fieldName = $relName . 'ID';
|
||||
$rel = $this->config()->api_base;
|
||||
@ -140,6 +143,7 @@ class JSONDataFormatter extends DataFormatter
|
||||
$innerParts = array();
|
||||
$items = $obj->$relName();
|
||||
foreach ($items as $item) {
|
||||
if (!$item->canView()) continue;
|
||||
$rel = $this->config()->api_base . $this->sanitiseClassName($relClass) . "/$item->ID";
|
||||
$href = Director::absoluteURL($rel);
|
||||
$innerParts[] = ArrayData::array_to_object(array(
|
||||
|
Loading…
Reference in New Issue
Block a user