Skip to content

Commit 0fce8c1

Browse files
author
Till Brehm
committed
Fixed #5351 Remote API function dns_templatezone_add issue
Added test script for dns_templatezone_add remote API function
1 parent 80e4c48 commit 0fce8c1

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

interface/lib/classes/remote.d/aps.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ public function sites_aps_install_package($session_id, $primary_id, $params)
238238
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
239239
return false;
240240
}
241+
242+
$app->uses('remoting_lib');
243+
$app->remoting_lib->loadUserProfile(0);
241244

242245
$app->load('aps_guicontroller');
243246
$gui = new ApsGUIController($app);

interface/lib/classes/remote.d/dns.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public function dns_templatezone_add($session_id, $client_id, $template_id, $dom
5656
$tform_def_file = "../../web/dns/form/dns_soa.tform.php";
5757
$app->uses('tform');
5858
$app->tform->loadFormDef($tform_def_file);
59-
$app->uses('tpl,validate_dns');
59+
$app->uses('tpl,validate_dns,remoting_lib');
60+
61+
$app->remoting_lib->loadUserProfile($client_id);
6062

6163
//* replace template placeholders
6264
$tpl_content = $template_record['template'];
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
require 'soap_config.php';
4+
5+
// Disable SSL verification for this test script
6+
$context = stream_context_create([
7+
'ssl' => [
8+
// set some SSL/TLS specific options
9+
'verify_peer' => false,
10+
'verify_peer_name' => false,
11+
'allow_self_signed' => true
12+
]
13+
]);
14+
15+
$client = new SoapClient(null, array('location' => $soap_location,
16+
'uri' => $soap_uri,
17+
'trace' => 1,
18+
'exceptions' => 1,
19+
'stream_context' => $context));
20+
21+
22+
try {
23+
if($session_id = $client->login($username, $password)) {
24+
echo 'Logged successfull. Session ID:'.$session_id.'<br />';
25+
}
26+
27+
//* Set the function parameters.
28+
$client_id = 1;
29+
$template_id = 1;
30+
$domain = 'test.tld';
31+
$ip = '192.168.0.100';
32+
$ns1 = 'ns1.testhoster.tld';
33+
$ns2 = 'ns2.testhoster.tld';
34+
$email = 'email.test.tld';
35+
36+
$id = $client->dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email);
37+
38+
echo "ID: ".$id."<br>";
39+
40+
if($client->logout($session_id)) {
41+
echo 'Logged out.<br />';
42+
}
43+
44+
45+
} catch (SoapFault $e) {
46+
echo $client->__getLastResponse();
47+
die('SOAP Error: '.$e->getMessage());
48+
}
49+
50+
?>

0 commit comments

Comments
 (0)