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:
parent
f24b238e30
commit
820d2bf172
15 changed files with 447 additions and 26 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue