Block viewing node allocations and location unless user has permission
Blocks viewing the allocation list and location for a node unless a user has permission to view the node in the first place.
This commit is contained in:
parent
4479d3bf19
commit
463f465dea
1 changed files with 8 additions and 0 deletions
|
@ -80,6 +80,10 @@ class NodeTransformer extends TransformerAbstract
|
||||||
*/
|
*/
|
||||||
public function includeAllocations(Node $node)
|
public function includeAllocations(Node $node)
|
||||||
{
|
{
|
||||||
|
if ($this->request && ! $this->request->apiKeyHasPermission('view-node')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->collection($node->allocations, new AllocationTransformer, 'allocation');
|
return $this->collection($node->allocations, new AllocationTransformer, 'allocation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +94,10 @@ class NodeTransformer extends TransformerAbstract
|
||||||
*/
|
*/
|
||||||
public function includeLocation(Node $node)
|
public function includeLocation(Node $node)
|
||||||
{
|
{
|
||||||
|
if ($this->request && ! $this->request->apiKeyHasPermission('view-node')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->item($node->location, new LocationTransformer, 'location');
|
return $this->item($node->location, new LocationTransformer, 'location');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue