Files
pterodactyl-panel/app/Contracts/Subusers/CreatesSubusers.php
T
2026-10-12 05:18:56 -04:00

33 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Contracts\Subusers;
use Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException;
use Pterodactyl\Exceptions\Service\Subuser\UserIsServerOwnerException;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Subuser;
use Throwable;
interface CreatesSubusers
{
/**
* Creates a new user on the system and assigns them access to the provided server.
* If the email address already belongs to a user on the system a new user will not
* be created.
*
* The email address and the permissions are validated here, so they can come straight
* from any caller: each permission must be one the panel or an enabled extension
* defines. Whether the caller may grant them is left to the caller.
*
* @param list<string> $permissions The permission keys to grant, deduplicated
* before they are stored.
*
* @throws ServerSubuserExistsException
* @throws UserIsServerOwnerException
* @throws Throwable
*/
public function create(Server $server, string $email, array $permissions): Subuser;
}