mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
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:
@@ -80,7 +80,11 @@ class ServiceTransformer extends TransformerAbstract
|
||||
*/
|
||||
public function includeOptions(Service $service)
|
||||
{
|
||||
return $this->collection($service->options, new OptionTransformer, 'option');
|
||||
if ($this->request && ! $this->request->apiKeyHasPermission('service-view')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->collection($service->options, new OptionTransformer($this->request), 'option');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +94,11 @@ class ServiceTransformer extends TransformerAbstract
|
||||
*/
|
||||
public function includeServers(Service $service)
|
||||
{
|
||||
return $this->collection($service->servers, new ServerTransformer, 'server');
|
||||
if ($this->request && ! $this->request->apiKeyHasPermission('service-view')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->collection($service->servers, new ServerTransformer($this->request), 'server');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,6 +108,10 @@ class ServiceTransformer extends TransformerAbstract
|
||||
*/
|
||||
public function includePacks(Service $service)
|
||||
{
|
||||
return $this->collection($service->packs, new PackTransformer, 'pack');
|
||||
if ($this->request && ! $this->request->apiKeyHasPermission('service-view')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->collection($service->packs, new PackTransformer($this->request), 'pack');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user