Files

34 lines
870 B
PHP
Raw Permalink Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Subusers;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Enum\Permissions;
use Pterodactyl\Exceptions\Http\HttpForbiddenException;
class DeleteSubuserRequest extends SubuserRequest
{
2022-10-14 10:59:20 -06:00
public function permission(): string
{
2026-10-05 18:10:18 -04:00
return Permissions::UserDelete->value;
}
public function authorize(): bool
{
if (! parent::authorize()) {
return false;
}
if ($this->requesterHasFullAccess()) {
return true;
}
$exceeding = array_diff($this->subuser()->permissions, $this->requesterPermissions(), [Permissions::WebsocketConnect->value]);
throw_if(count($exceeding) > 0, HttpForbiddenException::class, 'Cannot remove a subuser that has permissions your account does not actively possess.');
return true;
}
}