Skip to content

Commit 0fd51fc

Browse files
committed
Fixed: FS#786 - Client with enables client module cannot choose a client when adding a dns zone
Fixed: FS#787 - A sub-client can see all the clients on the system in the client drop down list
1 parent bf78767 commit 0fd51fc

File tree

5 files changed

+53
-6
lines changed

5 files changed

+53
-6
lines changed

interface/web/dns/dns_soa_edit.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function onShowEnd() {
7676
global $app, $conf;
7777

7878
// If user is admin, we will allow him to select to whom this record belongs
79-
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
79+
if($_SESSION["s"]["user"]["typ"] == 'admin') {
8080
// Getting Domains of the user
8181
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0";
8282
$clients = $app->db->queryAllRecords($sql);
@@ -89,6 +89,24 @@ function onShowEnd() {
8989
}
9090
}
9191
$app->tpl->setVar("client_group_id",$client_select);
92+
} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
93+
94+
// Get the limits of the client
95+
$client_group_id = $_SESSION["s"]["user"]["default_group"];
96+
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
97+
98+
// Fill the client select field
99+
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
100+
$clients = $app->db->queryAllRecords($sql);
101+
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
102+
if(is_array($clients)) {
103+
foreach( $clients as $client) {
104+
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
105+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
106+
}
107+
}
108+
$app->tpl->setVar("client_group_id",$client_select);
109+
92110
}
93111

94112
parent::onShowEnd();

interface/web/dns/dns_wizard.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,30 @@
9393
}
9494

9595
$app->tpl->setVar("client_group_id",$client_select);
96+
}
97+
98+
if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
99+
100+
// Get the limits of the client
101+
$client_group_id = $_SESSION["s"]["user"]["default_group"];
102+
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
103+
96104

105+
// load the list of clients
106+
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
107+
$clients = $app->db->queryAllRecords($sql);
108+
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
109+
if(is_array($clients)) {
110+
foreach( $clients as $client) {
111+
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
112+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
113+
}
114+
}
115+
116+
$app->tpl->setVar("client_group_id",$client_select);
97117
}
98118

119+
99120
$template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
100121
$fields = explode(',',$template_record['fields']);
101122
if(is_array($fields)) {

interface/web/dns/templates/dns_wizard.htm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ <h2><tmpl_var name="list_head_txt"></h2>
2929
</select>
3030
</div>
3131
</tmpl_if>
32+
<tmpl_if name="is_reseller">
33+
<div class="ctrlHolder">
34+
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
35+
<select name="client_group_id" id="client_group_id" class="selectInput">
36+
{tmpl_var name='client_group_id'}
37+
</select>
38+
</div>
39+
</tmpl_if>
3240
<tmpl_if name="DOMAIN_VISIBLE">
3341
<div class="ctrlHolder">
3442
<label for="domain">{tmpl_var name='domain_txt'}</label>

interface/web/mail/mail_domain_edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function onShowEnd() {
9898

9999
// Get the limits of the client
100100
$client_group_id = $_SESSION["s"]["user"]["default_group"];
101-
$client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
101+
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
102102

103103
// Set the webserver to the default server of the client
104104
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
@@ -108,7 +108,7 @@ function onShowEnd() {
108108
// Fill the client select field
109109
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
110110
$clients = $app->db->queryAllRecords($sql);
111-
$client_select = '';
111+
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
112112
if(is_array($clients)) {
113113
foreach( $clients as $client) {
114114
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';

interface/web/sites/web_domain_edit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function onShowEnd() {
109109

110110
// Get the limits of the client
111111
$client_group_id = $_SESSION["s"]["user"]["default_group"];
112-
$client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
112+
$client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver, client.contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
113113

114114
// Set the webserver to the default server of the client
115115
$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
@@ -119,7 +119,7 @@ function onShowEnd() {
119119
// Fill the client select field
120120
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
121121
$clients = $app->db->queryAllRecords($sql);
122-
$client_select = '';
122+
$client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
123123
if(is_array($clients)) {
124124
foreach( $clients as $client) {
125125
$selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
@@ -207,7 +207,7 @@ function onSubmit() {
207207
if($_SESSION["s"]["user"]["typ"] != 'admin') {
208208
// Get the limits of the client
209209
$client_group_id = $_SESSION["s"]["user"]["default_group"];
210-
$client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
210+
$client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
211211

212212
// When the record is updated
213213
if($this->id > 0) {

0 commit comments

Comments
 (0)