From: hickert Date: Tue, 31 Oct 2006 05:31:19 +0000 (+0000) Subject: Added acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9b0cc725639fc9fc1a9bd9a7bbe2a87f8e18ccc0;p=gosa.git Added acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4965 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/addons/logview/class_logview.inc b/plugins/addons/logview/class_logview.inc index e7062ff30..1bde25d68 100644 --- a/plugins/addons/logview/class_logview.inc +++ b/plugins/addons/logview/class_logview.inc @@ -34,6 +34,8 @@ class logview extends plugin register_global("logfilter", $logfilter); } + + $this->ui = get_userinfo(); } function execute() @@ -147,6 +149,27 @@ class logview extends plugin $smarty->assign("regex", $logfilter['regex']); + + /* Get acls */ + + $tmp_cat_bases = $this->ui->get_module_departments("logview"); + $all_acls = ""; + foreach($tmp_cat_bases as $acl_base){ + $all_acls .= $this->ui->get_permissions($acl_base,"logview/logview"); + } + if(count($tmp_cat_bases) == 0 || !preg_match("/r/",$all_acls)){ + $res = " + + "._("You have insufficient permissions to view syslog entries.")." + + "; + + /* Show main page */ + $smarty->assign("range_selector", ""); + $smarty->assign("search_result", $res); + return ($smarty->fetch (get_template_path('contents.tpl', TRUE))); + } + /* Query stuff */ $res= ""; $cfg = $this->config->data['SERVERS']['LOG']; @@ -220,13 +243,13 @@ class logview extends plugin } $end= date ("YmdHis"); $query_base= " FROM - golog - WHERE - message like '".preg_replace("/\*/","%",$logfilter['regex'])."' - $ll - $hf - AND - time_stamp <= $end AND time_stamp >= $start"; + golog + WHERE + message like '".preg_replace("/\*/","%",$logfilter['regex'])."' + $ll + $hf + AND + time_stamp <= $end AND time_stamp >= $start"; /* Get number of entries */ $query= "SELECT COUNT(*)".$query_base.";"; @@ -246,7 +269,11 @@ class logview extends plugin /* Display results */ $mod= 0; + + /* Add entries to result str */ while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){ + + /* Toggle background color */ if ( ($mod++) & 1){ $col= "background-color: #ECECEC;"; } else { @@ -255,19 +282,19 @@ class logview extends plugin $res.=" \n"; $res.=" - \"".$line['log_level']."\" - - ". - $line['host']." - "; + \"".$line['log_level']."\" + "; $res.=" ". - $line['time_stamp']." - - ". - $line['message']." - "; + $line['host']." + "; + $res.=" ". + $line['time_stamp']." + "; + $res .= "". + $line['message']." + "; $res.=" \n"; } mysql_close($link); @@ -347,6 +374,24 @@ class logview extends plugin } } } + + + /* Return plugin informations for acl handling + #FIXME You can only read attributes within this report plugin */ + function plInfo() + { + return (array( + "plShortName" => _("Log view"), + "plDescription" => _("Log view addon"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("addon"), + "plCategory" => array("logview" => array("objectClass" => "none", "description" => _("System logs"))), + + "plProvidedAcls" => array() + )); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/addons/logview/contents.tpl b/plugins/addons/logview/contents.tpl index bb62fc3ef..2262604ad 100644 --- a/plugins/addons/logview/contents.tpl +++ b/plugins/addons/logview/contents.tpl @@ -53,15 +53,16 @@   - +
@@ -69,7 +70,6 @@
- diff --git a/plugins/addons/logview/main.inc b/plugins/addons/logview/main.inc index 6b3469267..1e4bf5278 100644 --- a/plugins/addons/logview/main.inc +++ b/plugins/addons/logview/main.inc @@ -19,9 +19,11 @@ */ if (!$remove_lock){ + /* Create logview object on demand */ if (!isset($_SESSION['logview']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ $_SESSION['logview']= new logview ($config); + $_SESSION['logview']->set_acl_category("logview"); } $logview= $_SESSION['logview'];