Skip to content

Commit 0d63abf

Browse files
Merge pull request plesk#18 from vbaranovskiy-plesk/master
Add possibility to specify login for 'sdk' protocol
2 parents 2df08d7 + 761f85b commit 0d63abf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/PleskX/Api/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function request($request, $mode = self::RESPONSE_SHORT)
138138

139139
if ('sdk' == $this->_protocol) {
140140
$requestXml = new SimpleXMLElement((string)$request);
141-
$xml = \pm_ApiRpc::getService()->call($requestXml->children()[0]->asXml());
141+
$xml = \pm_ApiRpc::getService()->call($requestXml->children()[0]->asXml(), $this->_login);
142142
} else {
143143
$xml = $this->_performHttpRequest($request);
144144
}

src/PleskX/Api/InternalClient.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@ public function __construct()
1212
{
1313
parent::__construct('localhost', 0, 'sdk');
1414
}
15-
}
15+
16+
/**
17+
* Setup login to execute requests under certain user
18+
*
19+
* @param $login
20+
*/
21+
public function setLogin($login)
22+
{
23+
$this->_login = $login;
24+
}
25+
}

0 commit comments

Comments
 (0)