diff --git a/install/tpl/system.ini.master b/install/tpl/system.ini.master
index d6dfa18f47f61ed5598c56edb8d6bc81f15732c0..05fb9178752550b6eadf9ef961196c4b00e5c9d0 100644
--- a/install/tpl/system.ini.master
+++ b/install/tpl/system.ini.master
@@ -1,4 +1,5 @@
 [global]
+client_protection=y
 
 [admin]
 
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index cc476a2276f8c87206859aa9bdb4717e30be4df6..f5a66340a08357b336b6055ba1eaa4bf5b751d6a 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -1376,11 +1376,17 @@ class page_action extends tform_actions {
 	function onAfterInsert() {
 		global $app, $conf;
 
-		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
+		// 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 web_domain SET sys_groupid = ?, sys_perm_group = 'ru' WHERE domain_id = ?", $client_group_id, $this->id);
+  	  $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+	  	$app->uses('getconf');
+	  	$global_config = $app->getconf->get_global_config('global');
+	  	if($global_config['client_protection'] == 'y') {
+		    $app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'ru' WHERE domain_id = ?", $client_group_id, $this->id);
+			  else
+				$app->db->query("UPDATE web_domain SET sys_groupid = ?, sys_perm_group = 'riud' WHERE domain_id = ?", $client_group_id, $this->id);
+			}
 		}
 		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);