Commit bb50b985 authored by Marius Burkard's avatar Marius Burkard
Browse files

Merge branch '6332-mail_user_get_all_by_client' into 'develop'

Add API function mail_user_get_all_by_client, #6332

Closes #6332

See merge request !1599
parents 52348ef9 4c83fa6e
Pipeline #11818 passed with stage
in 8 seconds
......@@ -196,6 +196,24 @@ class remoting_mail extends remoting {
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Get mail user details for all account that belong to a client.
public function mail_user_get_all_by_client($session_id, $client_id)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_user_get_all_by_client')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$sql = "SELECT u.* FROM `mail_user` u
LEFT JOIN `sys_group` g ON (u.sys_groupid=g.groupid)
WHERE g.client_id=?";
$params[] = $client_id;
$result = $app->db->queryAllRecords($sql, true, $params);
return $result;
}
//* Add mail domain
public function mail_user_add($session_id, $client_id, $params){
......@@ -1110,4 +1128,4 @@ class remoting_mail extends remoting {
}
?>
\ No newline at end of file
?>
......@@ -3,7 +3,7 @@
$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete,mail_domain_set_status,mail_domain_get_by_domain'] = 'Mail domain functions';
$function_list['mail_aliasdomain_get,mail_aliasdomain_add,mail_aliasdomain_update,mail_aliasdomain_delete'] = 'Mail domain alias functions';
$function_list['mail_mailinglist_get,mail_mailinglist_add,mail_mailinglist_update,mail_mailinglist_delete'] = 'Mail mailinglist functions';
$function_list['mail_user_get,mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions';
$function_list['mail_user_get,mail_user_add,mail_user_update,mail_user_delete,mail_user_get_all_by_client'] = 'Mail user functions';
$function_list['mail_alias_get,mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions';
$function_list['mail_forward_get,mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions';
$function_list['mail_catchall_get,mail_catchall_add,mail_catchall_update,mail_catchall_delete'] = 'Mail catchall functions';
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>ISPCOnfig 3 remote API documentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="definitionen.css">
<style type="text/css">
</style></head>
<body>
<div style="padding:40px">
<h1>mail_user_get_all_by_client(<span class="var">$session_id</span>, <span class="var">$client_id</span>);</h1>
<br>
<p class="headgrp">Description: </p>
<p class="margin"> Retrieves information about the mail users belonging to a client.</p><br>
<p class="headgrp">Input Variables: </p>
<p class="margin"> <span class="var">$session_id</span>, <span class="var">$primary_id</span></p>
<p class="headgrp">Parameters (in <span class="var">$params</span>): </p>
<p class="margin"> None</p>
<p class="headgrp">Output: </p>
<p class="margin"> Returns all fields and values of the chosen mail users.</p>
<!--<b>Output:</b>
<p style="margin-left:100px">Gives a record of </p> -->
</div>
</body></html>
<?php
require 'soap_config.php';
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
echo 'Logged successfull. Session ID:'.$session_id.'<br />';
}
//* Set the function parameters.
$client_id = 1;
$app = $client->mail_user_get_all_by_client($session_id, $client_id);
print_r($app);
if($client->logout($session_id)) {
echo 'Logged out.<br />';
}
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment