From e0db878eb71dd40d6c000f1debedad3f16f15ba6 Mon Sep 17 00:00:00 2001
From: chjacobsen <chjacobsen@ispconfig3>
Date: Fri, 1 Apr 2011 19:59:23 +0000
Subject: [PATCH] Adding a new client remotelly, it was not been associated to
 the proper reseller.

---
 interface/lib/classes/remoting.inc.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index afddd0cc5..4ecde3623 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -2004,6 +2004,14 @@ class remoting {
 			$new_rec = $app->remoting_lib->getDataRecord($insert_id);
 			$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);			
 			$app->remoting_lib->ispconfig_sysuser_add($params,$insert_id);
+
+            if($reseller_id) {
+                $client_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = ".$insert_id);
+                $reseller_user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = ".$reseller_id);
+                $app->auth->add_group_to_user($reseller_user['userid'], $client_group['groupid']);
+                $app->db->query("UPDATE client SET parent_client_id = ".$reseller_id." WHERE client_id = ".$insert_id);
+            }   
+
 		}
 		return $insert_id;
 	}
-- 
GitLab