mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:27:03 +02:00
updated the group handling + revised admin permissions
This commit is contained in:
@ -26,6 +26,8 @@ class ControllerGroupAdd extends Controller {
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$ret = 0;
|
||||
|
||||
$this->data['post'] = $this->request->post;
|
||||
|
||||
if($this->validate() == true){
|
||||
$ret = $this->model_group_group->add_group($this->request->post);
|
||||
|
||||
|
@ -38,8 +38,6 @@ class ControllerGroupEdit extends Controller {
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
|
||||
$this->data['group'] = $this->model_group_group->get_domain_by_id($this->data['id']);
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
if($this->validate() == true){
|
||||
@ -59,6 +57,7 @@ class ControllerGroupEdit extends Controller {
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->data['group'] = $this->model_group_group->get_domain_by_id($this->data['id']);
|
||||
$this->data['email'] = $this->model_group_group->get_emails_by_group_id($this->data['id']);
|
||||
}
|
||||
}
|
||||
|
48
webui/controller/group/email.php
Normal file
48
webui/controller/group/email.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerGroupEmail extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "user/list.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$language = Registry::get('language');
|
||||
|
||||
$this->load->model('group/group');
|
||||
|
||||
|
||||
$this->data['term'] = '';
|
||||
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 2) { die("no data"); }
|
||||
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
$emails = $this->model_group_group->get_emails_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
|
||||
foreach($emails as $email) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $email['email'] . '" },';
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
|
||||
print $s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
48
webui/controller/group/group.php
Normal file
48
webui/controller/group/group.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerGroupGroup extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "user/list.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
$language = Registry::get('language');
|
||||
|
||||
$this->load->model('group/group');
|
||||
|
||||
|
||||
$this->data['term'] = '';
|
||||
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 2) { die("no data"); }
|
||||
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
$results = $this->model_group_group->get_groups_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
|
||||
foreach($results as $result) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $result['groupname'] . '" },';
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
|
||||
print $s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -19,7 +19,7 @@ class ControllerHealthHealth extends Controller {
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') != 1 && Registry::get('readonly_admin') != 1 && Registry::get('auditor_admin') != 1) {
|
||||
if(Registry::get('admin_user') != 1 && Registry::get('readonly_admin') != 1) {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
@ -71,9 +71,9 @@ class ControllerUserEdit extends Controller {
|
||||
}
|
||||
else {
|
||||
$this->data['user'] = $this->model_user_user->get_user_by_uid($this->data['uid']);
|
||||
$this->data['groups'] = $this->model_group_group->get_groups();
|
||||
|
||||
$this->data['user']['group_membership'] = $this->model_user_user->get_additional_uids($this->data['uid']);
|
||||
$this->data['user']['group'] = $this->model_group_group->get_groups_by_uid($this->data['uid']);
|
||||
|
||||
$this->data['emails'] = $this->model_user_user->get_emails($this->data['user']['username']);
|
||||
|
||||
|
Reference in New Issue
Block a user