From 20fd2cce482389d5c80a78a9f247c10562177a48 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Mon, 2 Sep 2019 14:15:54 +0200
Subject: [PATCH] Implemented #5375 Add WebDAV functions to remoting API

---
 interface/lib/classes/remote.d/sites.inc.php | 50 ++++++++++++++++++++
 interface/web/sites/lib/remote.conf.php      |  1 +
 2 files changed, 51 insertions(+)

diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php
index a2f15d6f9d..59c2e371f3 100644
--- a/interface/lib/classes/remote.d/sites.inc.php
+++ b/interface/lib/classes/remote.d/sites.inc.php
@@ -1017,6 +1017,56 @@ class remoting_sites extends remoting {
 		return $app->quota_lib->get_databasequota_data($client_id, false);
 	}
 	
+	// ----------------------------------------------------------------------------------------------------------
+
+	//* Get record details
+	public function sites_webdav_user_get($session_id, $primary_id)
+	{
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'sites_webdav_user_get')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$app->uses('remoting_lib');
+		$app->remoting_lib->loadFormDef('../sites/form/webdav_user.tform.php');
+		return $app->remoting_lib->getDataRecord($primary_id);
+	}
+
+	//* Add a record
+	public function sites_webdav_user_add($session_id, $client_id, $params)
+	{
+		if(!$this->checkPerm($session_id, 'sites_webdav_user_add')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		return $this->insertQuery('../sites/form/webdav_user.tform.php', $client_id, $params);
+	}
+
+	//* Update a record
+	public function sites_webdav_user_update($session_id, $client_id, $primary_id, $params)
+	{
+		if(!$this->checkPerm($session_id, 'sites_webdav_user_update')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../sites/form/webdav_user.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
+	}
+
+	//* Delete a record
+	public function sites_webdav_user_delete($session_id, $primary_id)
+	{
+		global $app;
+		if(!$this->checkPerm($session_id, 'sites_webdav_user_delete')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		$affected_rows = $this->deleteQuery('../sites/form/webdav_user.tform.php', $primary_id);
+		return $affected_rows;
+	}
+	
 	
 }
 
diff --git a/interface/web/sites/lib/remote.conf.php b/interface/web/sites/lib/remote.conf.php
index a9ef3236b7..19a48e3ca5 100644
--- a/interface/web/sites/lib/remote.conf.php
+++ b/interface/web/sites/lib/remote.conf.php
@@ -9,4 +9,5 @@ $function_list['sites_web_domain_backup'] = 'Sites Backup functions';
 $function_list['sites_web_aliasdomain_get,sites_web_aliasdomain_add,sites_web_aliasdomain_update,sites_web_aliasdomain_delete'] = 'Sites Aliasdomain functions';
 $function_list['sites_web_subdomain_get,sites_web_subdomain_add,sites_web_subdomain_update,sites_web_subdomain_delete'] = 'Sites Subdomain functions';
 $function_list['sites_aps_update_package_list,sites_aps_available_packages_list,sites_aps_change_package_status,sites_aps_install_package,sites_aps_get_package_details,sites_aps_get_package_file,sites_aps_get_package_settings,sites_aps_instance_get,sites_aps_instance_delete'] = 'Sites APS functions';
+$function_list['sites_webdav_user_get,sites_webdav_user_add,sites_webdav_user_update,sites_webdav_user_delete'] = 'Sites WebDAV-User functions';
 ?>
-- 
GitLab