From 72773a6744609fdbc3bf39f58f073b05bd074c70 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Wed, 13 May 2015 02:50:27 -0400
Subject: [PATCH] Merge branch 'stable-3.0.5'

---
 interface/web/sites/webdav_user_edit.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php
index 42c75ca..73e47eb 100644
--- a/interface/web/sites/webdav_user_edit.php
+++ b/interface/web/sites/webdav_user_edit.php
@@ -137,6 +137,15 @@
 
 			/* restrict the names */
 			$this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
+
+			/*
+			*  Get the data of the domain, owning the webdav user
+			*/
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+			/* The server is the server of the domain */
+			$this->dataRecord["server_id"] = $web["server_id"];
+			/* The Webdav user shall be owned by the same group then the website */
+			$this->dataRecord["sys_groupid"] = $web['sys_groupid'];
 		}
 
 		parent::onBeforeInsert();
@@ -159,7 +168,6 @@
 		
 		$sql = "UPDATE webdav_user SET server_id = ?, sys_groupid = ?, password = ? WHERE webdav_user_id = ?";
 		$app->db->query($sql, $server_id, $sys_groupid, $this->dataRecord["password"], $this->id);
-		
 	}
 
 	function onBeforeUpdate() {

--
Gitblit v1.9.1