mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 06:13:45 +02:00
Fix daemon key provider service
Handles missing keys if user is an admin or the server owner. Step in the right direction for #733 where all users have their own keys now. Still need to address admin status revocation in order to fully address that issue.
This commit is contained in:
@@ -39,6 +39,26 @@ class DaemonKeyRepository extends EloquentRepository implements DaemonKeyReposit
|
||||
return DaemonKey::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the server and user relations onto a key model.
|
||||
*
|
||||
* @param \Pterodactyl\Models\DaemonKey $key
|
||||
* @param bool $refresh
|
||||
* @return \Pterodactyl\Models\DaemonKey
|
||||
*/
|
||||
public function loadServerAndUserRelations(DaemonKey $key, bool $refresh = false): DaemonKey
|
||||
{
|
||||
if (! $key->relationLoaded('server') || $refresh) {
|
||||
$key->load('server');
|
||||
}
|
||||
|
||||
if (! $key->relationLoaded('user') || $refresh) {
|
||||
$key->load('user');
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user