Commit 5712a610 authored by mcramer's avatar mcramer

Implemented FS#1938 - Add functions to manage password protected folders to remote api

parent ab7597c7
......@@ -1550,6 +1550,112 @@ class remoting {
return $affected_rows;
}
// ----------------------------------------------------------------------------------------------------------
//* Get record details
public function sites_web_folder_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../sites/form/web_folder.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a record
public function sites_web_folder_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_add')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../sites/form/web_folder.tform.php',$client_id,$params);
}
//* Update a record
public function sites_web_folder_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_update')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php',$client_id,$primary_id,$params);
return $affected_rows;
}
//* Delete a record
public function sites_web_folder_delete($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_delete')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
// Delete all users that belong to this folder. - taken from web_folder_delete.php
$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".intval($primary_id)."'");
foreach($records as $rec) {
$this->deleteQuery('../sites/form/web_folder_user.tform.php',$rec['web_folder_user_id']);
//$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
}
unset($records);
$affected_rows = $this->deleteQuery('../sites/form/web_folder.tform.php',$primary_id);
return $affected_rows;
}
// -----------------------------------------------------------------------------------------------
//* Get record details
public function sites_web_folder_user_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'sites_web_folder_user_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../sites/form/web_folder_user.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Add a record
public function sites_web_folder_user_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_add')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
return $this->insertQuery('../sites/form/web_folder_user.tform.php',$client_id,$params);
}
//* Update a record
public function sites_web_folder_user_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_update')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php',$client_id,$primary_id,$params);
return $affected_rows;
}
//* Delete a record
public function sites_web_folder_user_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'sites_web_folder_user_delete')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php',$primary_id);
return $affected_rows;
}
// -----------------------------------------------------------------------------------------------
//* Get record details
......
<?php
$function_list['sites_cron_get,sites_cron_add,sites_cron_update,sites_cron_delete'] = 'Sites cron functions';
$function_list['sites_database_get,sites_database_add,sites_database_update,sites_database_delete, sites_database_get_all_by_user'] = 'Sites database functions';
$function_list['sites_web_folder_get,sites_web_folder_add,sites_web_folder_update,sites_web_folder_delete,sites_web_folder_user_get,sites_web_folder_user_add,sites_web_folder_user_update,sites_web_folder_user_delete'] = 'Sites Protected folder functions';
$function_list['sites_ftp_user_get,sites_ftp_user_add,sites_ftp_user_update,sites_ftp_user_delete'] = 'Sites FTP-User functions';
$function_list['sites_shell_user_get,sites_shell_user_add,sites_shell_user_update,sites_shell_user_delete'] = 'Sites Shell-User functions';
$function_list['sites_web_domain_get,sites_web_domain_add,sites_web_domain_update,sites_web_domain_delete,sites_web_domain_set_status'] = 'Sites Domain functions';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment