Code

Added rSyslog service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Dec 2009 17:19:50 +0000 (17:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Dec 2009 17:19:50 +0000 (17:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14902 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc [new file with mode: 0644]
gosa-plugins/rsyslog/admin/systems/services/rsyslog/gosaLogServer.tpl [new file with mode: 0644]

diff --git a/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc b/gosa-plugins/rsyslog/admin/systems/services/rsyslog/class_rSyslogServer.inc
new file mode 100644 (file)
index 0000000..cb2d509
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+
+class rSyslogServer extends goService{
+       
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("rSyslogServer");
+  var $attributes       = array("rSyslogDatabase","rSyslogUser","rSyslogPassword");
+  var $StatusFlag       = "";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("rSyslogServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                 = "";
+  var $rSyslogDatabase    = "";
+  var $rSyslogUser        = "";
+  var $rSyslogPassword    = "";  
+  var $view_logged  =FALSE;
+
+
+  function rSyslogServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("rSyslog");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("rSyslogServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']      = _("rSyslog logging service");
+    #$fields['AllowEdit']    = true;
+    #$fields['AllowStart']   = FALSE;
+    #$fields['AllowStop']    = FALSE;
+    #$fields['AllowRestart'] = FALSE;
+    return($fields);
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    if (empty($this->rSyslogUser)){
+      $message[]= msgPool::required(_("User"));
+    }
+    if (empty($this->rSyslogPassword)){
+      $message[]= msgPool::required(_("Password"));
+    }
+    if (empty($this->rSyslogDatabase)){
+      $message[]= msgPool::required(_("Database"));
+    }
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['rSyslogServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("rSyslog logging service"),
+          "plDescription" => _("rSyslog logging service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 99,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "rSyslogDatabase" => _("Database"),
+            "rSyslogUser"     => _("User"),
+            "rSyslogPassword" => _("Password"), 
+            "viewEntries"     => _("Allow view of entries on this server")) 
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/rsyslog/admin/systems/services/rsyslog/gosaLogServer.tpl b/gosa-plugins/rsyslog/admin/systems/services/rsyslog/gosaLogServer.tpl
new file mode 100644 (file)
index 0000000..b4f1c46
--- /dev/null
@@ -0,0 +1,35 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}rSyslog logging database{/t}</h2>
+<table summary="">
+    <tr>
+     <td>{t}Database{/t}{$must}</td>
+     <td>
+{render acl=$rSyslogDatabaseACL}
+       <input name="rSyslogDatabase" id="rSyslogDatabase" size=30 maxlength=60 value="{$rSyslogDatabase}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Database user{/t}{$must}</td>
+     <td>
+{render acl=$rSyslogUserACL}
+       <input name="rSyslogUser" id="rSyslogUser" size=30 maxlength=60 value="{$rSyslogUser}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$rSyslogPasswordACL}
+       <input type="password" name="rSyslogPassword" id="rSyslogPassword" size=30 maxlength=60 value="{$rSyslogPassword}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{msgPool type=saveButton}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{msgPool type=cancelButton}'>
+</div>
+<input type="hidden" name="rSyslogServerPosted" value="1">