diff --git a/app/Transformers/Admin/NodeTransformer.php b/app/Transformers/Admin/NodeTransformer.php index cc42719a9..7f93410c8 100644 --- a/app/Transformers/Admin/NodeTransformer.php +++ b/app/Transformers/Admin/NodeTransformer.php @@ -80,6 +80,10 @@ class NodeTransformer extends TransformerAbstract */ public function includeAllocations(Node $node) { + if ($this->request && ! $this->request->apiKeyHasPermission('view-node')) { + return; + } + return $this->collection($node->allocations, new AllocationTransformer, 'allocation'); } @@ -90,6 +94,10 @@ class NodeTransformer extends TransformerAbstract */ public function includeLocation(Node $node) { + if ($this->request && ! $this->request->apiKeyHasPermission('view-node')) { + return; + } + return $this->item($node->location, new LocationTransformer, 'location'); }