Skip to content

Commit e9bb05d

Browse files
committed
change domain owner
1 parent d3be569 commit e9bb05d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

interface/web/client/domain_edit.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ function onSubmit() {
147147
}
148148
else {
149149
/*
150-
* We edit a existing one, but there is nothing to edit
150+
* We edit a existing one, but domain name can't be changed
151151
*/
152-
$this->dataRecord = $app->tform->getDataRecord($this->id);
152+
$oldData = $app->tform->getDataRecord($this->id);
153+
$this->dataRecord["domain"] = $oldData["domain"];
153154
}
154155
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
155156
if ($this->id == 0) {
@@ -199,6 +200,17 @@ function onAfterInsert() {
199200
}
200201
}
201202

203+
function onAfterUpdate() {
204+
global $app, $conf;
205+
206+
// make sure that the record belongs to the client group and not the admin group when admin inserts it
207+
// also make sure that the user can not delete domain created by a admin
208+
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
209+
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
210+
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
211+
}
212+
}
213+
202214
}
203215

204216
$page = new page_action;

interface/web/client/templates/domain_edit.htm

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@
77
<div class="ctrlHolder">
88
<label for="domain">{tmpl_var name='domain_txt'}</label>
99
<tmpl_if name="edit_disabled">
10-
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
10+
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" readonly="readonly" />
1111
<tmpl_else>
1212
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
1313
</tmpl_if>
1414
</div>
1515
<div class="ctrlHolder">
1616
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
17-
<tmpl_if name="edit_disabled">
18-
<select name="client_group_id" id="client_group_id" class="selectInput" disabled="disabled">
19-
{tmpl_var name='client_group_id'}
20-
</select>
21-
<tmpl_else>
2217
<select name="client_group_id" id="client_group_id" class="selectInput">
2318
{tmpl_var name='client_group_id'}
2419
</select>
25-
</tmpl_if>
2620
</div>
2721
</fieldset>
2822

0 commit comments

Comments
 (0)