Skip to content

Commit e7db797

Browse files
author
thom
committed
Make client protection configurable (#4048)
1 parent 43992c0 commit e7db797

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

install/tpl/system.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[global]
2+
client_protection=y
23

34
[admin]
45

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,11 +1376,17 @@ function onBeforeInsert() {
13761376
function onAfterInsert() {
13771377
global $app, $conf;
13781378

1379-
// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
1379+
// make sure that the record belongs to the client group and not the admin group when admin inserts it
13801380
// also make sure that the user can not delete domain created by a admin
13811381
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
1382-
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
1383-
$app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'ru' WHERE domain_id = ?", $client_group_id, $this->id);
1382+
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
1383+
$app->uses('getconf');
1384+
$global_config = $app->getconf->get_global_config('global');
1385+
if($global_config['client_protection'] == 'y') {
1386+
$app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'ru' WHERE domain_id = ?", $client_group_id, $this->id);
1387+
else
1388+
$app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'riud' WHERE domain_id = ?", $client_group_id, $this->id);
1389+
}
13841390
}
13851391
if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
13861392
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);

0 commit comments

Comments
 (0)