Node and user API routes implemented.

More attempts at the logic for API permissions, most likely will need
continued tweaking in the future, but base is there.
This commit is contained in:
Dane Everitt
2017-04-09 15:31:10 -04:00
parent f24b238e30
commit 820d2bf172
15 changed files with 447 additions and 26 deletions

View File

@@ -79,7 +79,11 @@ class LocationTransformer extends TransformerAbstract
*/
public function includeServers(Location $location)
{
return $this->collection($location->servers, new ServerTransformer, 'server');
if ($this->request && ! $this->request->apiKeyHasPermission('server-list')) {
return;
}
return $this->collection($location->servers, new ServerTransformer($this->request), 'server');
}
/**
@@ -89,6 +93,10 @@ class LocationTransformer extends TransformerAbstract
*/
public function includeNodes(Location $location)
{
return $this->collection($location->nodes, new NodeTransformer, 'node');
if ($this->request && ! $this->request->apiKeyHasPermission('location-list')) {
return;
}
return $this->collection($location->nodes, new NodeTransformer($this->request), 'node');
}
}