Commit e9bb05d4 authored by Sergio's avatar Sergio
Browse files

change domain owner

parent d3be5691
......@@ -147,9 +147,10 @@ class page_action extends tform_actions {
}
else {
/*
* We edit a existing one, but there is nothing to edit
* We edit a existing one, but domain name can't be changed
*/
$this->dataRecord = $app->tform->getDataRecord($this->id);
$oldData = $app->tform->getDataRecord($this->id);
$this->dataRecord["domain"] = $oldData["domain"];
}
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
if ($this->id == 0) {
......@@ -199,6 +200,17 @@ class page_action extends tform_actions {
}
}
function onAfterUpdate() {
global $app, $conf;
// make sure that the record belongs to the client group and not the admin group when admin inserts it
// also make sure that the user can not delete domain created by a admin
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
}
}
}
$page = new page_action;
......
......@@ -7,22 +7,16 @@
<div class="ctrlHolder">
<label for="domain">{tmpl_var name='domain_txt'}</label>
<tmpl_if name="edit_disabled">
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" />
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" readonly="readonly" />
<tmpl_else>
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
</tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
<tmpl_if name="edit_disabled">
<select name="client_group_id" id="client_group_id" class="selectInput" disabled="disabled">
{tmpl_var name='client_group_id'}
</select>
<tmpl_else>
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
</select>
</tmpl_if>
</div>
</fieldset>
......
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