Implement fix to allow root admins to view all servers.

closes #722
This commit is contained in:
Dane Everitt 2017-11-05 12:38:39 -06:00
parent fb2909a1c7
commit 6409fffdad
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
22 changed files with 143 additions and 166 deletions

View file

@ -31,12 +31,16 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI
* @param bool $refresh
* @return \Pterodactyl\Models\Subuser
*/
public function getWithServer(Subuser $subuser, bool $refresh = false): Subuser
public function loadServerAndUserRelations(Subuser $subuser, bool $refresh = false): Subuser
{
if (! $subuser->relationLoaded('server') || $refresh) {
$subuser->load('server');
}
if (! $subuser->relationLoaded('user') || $refresh) {
$subuser->load('user');
}
return $subuser;
}

View file

@ -31,7 +31,7 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa
{
Assert::integerish($id, 'First argument passed to getTaskWithServer must be numeric, received %s.');
$instance = $this->getBuilder()->with('server')->find($id, $this->getColumns());
$instance = $this->getBuilder()->with('server.user')->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
}