diff --git a/src/Api/Operator/Session.php b/src/Api/Operator/Session.php index eb2970bd..af2b7c68 100644 --- a/src/Api/Operator/Session.php +++ b/src/Api/Operator/Session.php @@ -7,6 +7,29 @@ class Session extends \PleskX\Api\Operator { + /** + * @param string $username + * @param string $userIp + * @param string $sourceServer + * + * @return string + */ + public function create($username, $userIp, $sourceServer = '') + { + $packet = $this->_client->getPacket(); + $creator = $packet->addChild('server')->addChild('create_session'); + + $creator->addChild('login', $username); + $loginData = $creator->addChild('data'); + + $loginData->addChild('user_ip', base64_encode($userIp)); + $loginData->addChild('source_server', base64_encode($sourceServer)); + + $response = $this->_client->request($packet); + + return (string) $response->id; + } + /** * @return Struct\Info[] */