Add permissions checking to API middleware list
This commit is contained in:
parent
49379bd115
commit
bf9708fe4f
8 changed files with 206 additions and 210 deletions
|
@ -21,4 +21,20 @@ class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInt
|
|||
{
|
||||
return APIKey::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load permissions for a key onto the model.
|
||||
*
|
||||
* @param \Pterodactyl\Models\APIKey $model
|
||||
* @param bool $refresh
|
||||
* @return \Pterodactyl\Models\APIKey
|
||||
*/
|
||||
public function loadPermissions(APIKey $model, bool $refresh = false): APIKey
|
||||
{
|
||||
if (! $model->relationLoaded('permissions') || $refresh) {
|
||||
$model->load('permissions');
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue