updated the group handling + revised admin permissions

This commit is contained in:
SJ
2012-06-25 22:14:30 +02:00
parent 9900f0aed2
commit 095f22c7b2
25 changed files with 323 additions and 68 deletions

View File

@ -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);

View File

@ -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']);
}
}

View 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;
}
}
}
?>

View 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;
}
}
}
?>

View File

@ -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'];
}

View File

@ -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']);