Implement initial server and location API routes.
Also fixes a few exception handler issues causing incorrect HTTP status codes on authorization errors.
This commit is contained in:
parent
463f465dea
commit
c492446513
12 changed files with 639 additions and 45 deletions
|
@ -57,4 +57,46 @@ class APIPermission extends Model
|
|||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* List of permissions available for the API.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $permissions = [
|
||||
// Items within this block are available to non-adminitrative users.
|
||||
'_user' => [
|
||||
'server' => [
|
||||
'list',
|
||||
'view',
|
||||
'power',
|
||||
'command',
|
||||
]
|
||||
],
|
||||
|
||||
// All other pemissions below are administrative actions.
|
||||
'server' => [
|
||||
'list',
|
||||
'view',
|
||||
'delete',
|
||||
'create',
|
||||
'edit-details',
|
||||
'edit-container',
|
||||
'suspend',
|
||||
'install',
|
||||
'rebuild',
|
||||
'edit-build',
|
||||
'edit-startup',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Return permissions for API
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function permissions()
|
||||
{
|
||||
return self::$permissions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace Pterodactyl\Models;
|
|||
use Auth;
|
||||
use Cache;
|
||||
use Carbon;
|
||||
use Schema;
|
||||
use Javascript;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
@ -203,6 +204,15 @@ class Server extends Model
|
|||
return Javascript::put($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the columns available for this table.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTableColumns() {
|
||||
return Schema::getColumnListing($this->getTable());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user who owns the server.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue