Merge branch 'develop' into feature/server-mounts
This commit is contained in:
commit
295f09ca43
195 changed files with 5395 additions and 5417 deletions
|
@ -9,6 +9,7 @@ namespace Pterodactyl\Models;
|
|||
* @property string|null $ip_alias
|
||||
* @property int $port
|
||||
* @property int|null $server_id
|
||||
* @property string|null $notes
|
||||
* @property \Carbon\Carbon|null $created_at
|
||||
* @property \Carbon\Carbon|null $updated_at
|
||||
*
|
||||
|
@ -60,6 +61,7 @@ class Allocation extends Model
|
|||
'port' => 'required|numeric|between:1024,65553',
|
||||
'ip_alias' => 'nullable|string',
|
||||
'server_id' => 'nullable|exists:servers,id',
|
||||
'notes' => 'nullable|string|max:256',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,9 @@ class Permission extends Model
|
|||
const ACTION_BACKUP_DOWNLOAD = 'backup.download';
|
||||
|
||||
const ACTION_ALLOCATION_READ = 'allocation.read';
|
||||
const ACTION_ALLOCIATION_UPDATE = 'allocation.update';
|
||||
const ACTION_ALLOCATION_CREATE = 'allocation.create';
|
||||
const ACTION_ALLOCATION_UPDATE = 'allocation.update';
|
||||
const ACTION_ALLOCATION_DELETE = 'allocation.delete';
|
||||
|
||||
const ACTION_FILE_READ = 'file.read';
|
||||
const ACTION_FILE_CREATE = 'file.create';
|
||||
|
@ -157,7 +159,9 @@ class Permission extends Model
|
|||
'description' => 'Permissions that control a user\'s ability to modify the port allocations for this server.',
|
||||
'keys' => [
|
||||
'read' => 'Allows a user to view the allocations assigned to this server.',
|
||||
'update' => 'Allows a user to modify the allocations assigned to this server.',
|
||||
'create' => 'Allows a user to assign additional allocations to the server.',
|
||||
'update' => 'Allows a user to change the primary server allocation and attach notes to each allocation.',
|
||||
'delete' => 'Allows a user to delete an allocation from the server.',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ class RecoveryToken extends Model
|
|||
*/
|
||||
const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@ use Illuminate\Support\Collection;
|
|||
use Illuminate\Validation\Rules\In;
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Pterodactyl\Models\Traits\Searchable;
|
||||
use Illuminate\Auth\Passwords\CanResetPassword;
|
||||
use Pterodactyl\Traits\Helpers\AvailableLanguages;
|
||||
|
@ -260,4 +261,21 @@ class User extends Model implements
|
|||
{
|
||||
return $this->hasMany(RecoveryToken::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the servers that a user can access by way of being the owner of the
|
||||
* server, or because they are assigned as a subuser for that server.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function accessibleServers()
|
||||
{
|
||||
return Server::query()
|
||||
->select('servers.*')
|
||||
->leftJoin('subusers', 'subusers.server_id', '=', 'servers.id')
|
||||
->where(function (Builder $builder) {
|
||||
$builder->where('servers.owner_id', $this->id)->orWhere('subusers.user_id', $this->id);
|
||||
})
|
||||
->groupBy('servers.id');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue