-
app/Traits/Services/HasUserLevels.php
Open in GitHubuse Pterodactyl\Models\User; trait HasUserLevels { private $userLevel = User::USER_LEVEL_USER; public function setUserLevel(int $level) { $this->userLevel = $level; return $this; } public function getUserLevel(): int { return $this->userLevel; } public function isUserLevel(int $level): bool { return $this->getUserLevel() === $level; } }
-
app/Services/Servers/VariableValidatorService.php
Open in GitHubuse Pterodactyl\Models\EggVariable; use Pterodactyl\Traits\Services\HasUserLevels; class VariableValidatorService { use HasUserLevels; // public function handle(int $egg, array $fields = []): Collection { $query = EggVariable::query()->where('egg_id', $egg); if (! $this->isUserLevel(User::USER_LEVEL_ADMIN)) { $query = $query->where('user_editable', true)->where('user_viewable', true); } // } // }