mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:27:03 +02:00
saas enhancements
This commit is contained in:
@ -63,6 +63,7 @@ class ControllerAuditHelper extends Controller {
|
||||
$this->data['actions'][ACTION_UNAUTHORIZED_REMOVE_MESSAGE] = $this->data['text_unauthorized_remove_message'];
|
||||
$this->data['actions'][ACTION_DOWNLOAD_ATTACHMENT] = $this->data['text_download_attachment2'];
|
||||
$this->data['actions'][ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT] = $this->data['text_unauthorized_download_attachment'];
|
||||
$this->data['actions'][ACTION_VIEW_JOURNAL] = $this->data['text_view_journal'];
|
||||
|
||||
|
||||
|
||||
@ -98,7 +99,7 @@ class ControllerAuditHelper extends Controller {
|
||||
while(list($k, $v) = each($b)) {
|
||||
if($v == '') { continue; }
|
||||
|
||||
if(preg_match("/(login|loginfailed|logout|view|download|search|restore)$/", $v) && isset($actions[$v])) { $this->a['action'] .= '*' . $actions[$v]; }
|
||||
if(preg_match("/(login|loginfailed|logout|view|download|search|restore|journal)$/", $v) && isset($actions[$v])) { $this->a['action'] .= '*' . $actions[$v]; }
|
||||
if(preg_match("/\@/", $v)) { $this->a['user'] .= '*' . $v; }
|
||||
if(preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $v)) { $this->a['ipaddr'] .= '*' . $v; }
|
||||
if(preg_match("/^\d{1,}$/", $v)) { $this->a['ref'] .= '*' . $v; }
|
||||
|
109
webui/controller/customer/list.php
Normal file
109
webui/controller/customer/list.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerCustomerList extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "customer/list.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('saas/customer');
|
||||
$this->load->model('domain/domain');
|
||||
|
||||
$this->document->title = $this->data['text_customers'];
|
||||
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
|
||||
$this->data['page'] = 0;
|
||||
$this->data['page_len'] = get_page_length();
|
||||
|
||||
$this->data['total'] = 0;
|
||||
|
||||
$this->data['entries'] = array();
|
||||
|
||||
$this->data['id'] = -1;
|
||||
|
||||
if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->validate() == true) {
|
||||
|
||||
if(isset($this->request->post['id'])) {
|
||||
if($this->model_saas_customer->update($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_modified'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_modify'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($this->model_saas_customer->add($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_add'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = array_pop($this->error);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['domains'] = $this->model_domain_domain->get_mapped_domains();
|
||||
|
||||
if(isset($this->request->get['id'])) {
|
||||
$this->data['a'] = $this->model_saas_customer->get($this->request->get['id']);
|
||||
}
|
||||
else {
|
||||
$this->data['entries'] = $this->model_saas_customer->get();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
private function validate() {
|
||||
|
||||
if(!isset($this->request->post['domain']) || strlen($this->request->post['domain']) < 1) {
|
||||
$this->error['domain'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->post['branding_text']) || strlen($this->request->post['branding_text']) < 1) {
|
||||
$this->error['branding_text'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
webui/controller/customer/remove.php
Normal file
79
webui/controller/customer/remove.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerCustomerRemove extends Controller {
|
||||
private $error = array();
|
||||
private $domains = array();
|
||||
private $d = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "customer/remove.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('saas/customer');
|
||||
|
||||
$this->document->title = $this->data['text_customers'];
|
||||
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$this->data['id'] = $this->request->get['id'];
|
||||
$this->data['domain'] = $this->request->get['domain'];
|
||||
$this->data['confirmed'] = (int)$this->request->get['confirmed'];
|
||||
|
||||
|
||||
if($this->validate() == true) {
|
||||
|
||||
if($this->data['confirmed'] == 1) {
|
||||
$ret = $this->model_saas_customer->delete($this->data['id'], $this->data['domain']);
|
||||
if($ret == 1){
|
||||
$this->data['x'] = $this->data['text_successfully_removed'];
|
||||
}
|
||||
else {
|
||||
$this->data['x'] = $this->data['text_failed_to_remove'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = array_pop($this->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
private function validate() {
|
||||
|
||||
if(Registry::get('admin_user') == 0) {
|
||||
$this->error['admin'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->get['domain']) || strlen($this->request->get['domain']) < 1) {
|
||||
$this->error['domain'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->get['id']) || !is_numeric($this->request->get['id'])) {
|
||||
$this->error['id'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -29,6 +29,11 @@ class ControllerLdapList extends Controller {
|
||||
|
||||
$this->data['entries'] = array();
|
||||
|
||||
$this->data['id'] = -1;
|
||||
|
||||
$this->data['ldap_types'] = Registry::get('ldap_types');
|
||||
|
||||
if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
@ -37,11 +42,21 @@ class ControllerLdapList extends Controller {
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
if($this->validate() == true) {
|
||||
|
||||
if($this->model_saas_ldap->add($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_add'];
|
||||
if(isset($this->request->post['id'])) {
|
||||
if($this->model_saas_ldap->update($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_modified'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_modify'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($this->model_saas_ldap->add($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_add'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -50,7 +65,12 @@ class ControllerLdapList extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['entries'] = $this->model_saas_ldap->get();
|
||||
if(isset($this->request->get['id'])) {
|
||||
$this->data['a'] = $this->model_saas_ldap->get($this->request->get['id']);
|
||||
}
|
||||
else {
|
||||
$this->data['entries'] = $this->model_saas_ldap->get();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -31,7 +31,7 @@ class ControllerMessageJournal extends Controller {
|
||||
die("no permission for " . $this->data['id']);
|
||||
}
|
||||
|
||||
AUDIT(ACTION_VIEW_HEADER, '', '', $this->data['id'], '');
|
||||
AUDIT(ACTION_VIEW_JOURNAL, '', '', $this->data['id'], '');
|
||||
|
||||
if(Registry::get('auditor_user') == 1) { $this->data['rcpt'] = $this->model_search_search->get_message_addresses_in_my_domain($this->data['id']); }
|
||||
|
||||
|
Reference in New Issue
Block a user