[Web] Add rsettings to API

master
André 2018-06-05 00:32:09 +02:00
parent 0a44ea1a4c
commit 69d5790130
1 changed files with 36 additions and 0 deletions

View File

@ -101,6 +101,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
case "relayhost": case "relayhost":
process_add_return(relayhost('add', $attr)); process_add_return(relayhost('add', $attr));
break; break;
case "rsetting":
process_add_return(rsettings('add', $attr));
break;
case "mailbox": case "mailbox":
process_add_return(mailbox('add', 'mailbox', $attr)); process_add_return(mailbox('add', 'mailbox', $attr));
break; break;
@ -359,6 +362,33 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
} }
break; break;
case "rsetting":
switch ($object) {
case "all":
$rsettings = rsettings('get');
if (!empty($rsettings)) {
foreach ($rsettings as $rsetting) {
if ($details = rsettings('details', $rsetting['id'])) {
$data[] = $details;
}
else {
continue;
}
}
process_get_return($data);
}
else {
echo '{}';
}
break;
default:
$data = rsetting('details', $object);
process_get_return($data);
break;
}
break;
case "oauth2-client": case "oauth2-client":
switch ($object) { switch ($object) {
case "all": case "all":
@ -922,6 +952,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
case "relayhost": case "relayhost":
process_delete_return(relayhost('delete', array('id' => $items))); process_delete_return(relayhost('delete', array('id' => $items)));
break; break;
case "rsetting":
process_delete_return(rsettings('delete', array('id' => $items)));
break;
case "syncjob": case "syncjob":
process_delete_return(mailbox('delete', 'syncjob', array('id' => $items))); process_delete_return(mailbox('delete', 'syncjob', array('id' => $items)));
break; break;
@ -1017,6 +1050,9 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
case "relayhost": case "relayhost":
process_edit_return(relayhost('edit', array_merge(array('id' => $items), $attr))); process_edit_return(relayhost('edit', array_merge(array('id' => $items), $attr)));
break; break;
case "rsetting":
process_edit_return(rsettings('edit', array_merge(array('id' => $items), $attr)));
break;
case "delimiter_action": case "delimiter_action":
process_edit_return(mailbox('edit', 'delimiter_action', array_merge(array('username' => $items), $attr))); process_edit_return(mailbox('edit', 'delimiter_action', array_merge(array('username' => $items), $attr)));
break; break;