summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1309e4e)
raw | patch | inline | side by side (parent: 1309e4e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Sep 2006 04:10:01 +0000 (04:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Sep 2006 04:10:01 +0000 (04:10 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4761 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_goSpamServer.inc b/plugins/admin/systems/class_goSpamServer.inc
index 1d47712203a724b0c2a3380daa0d805a23dc0923..5f4618d15bdacd2cc6cf6ecb55e25de70aa4932b 100644 (file)
<?php
-class gospamserver extends plugin{
+require_once("class_goService.inc");
+
+class gospamserver extends goService{
/* CLI vars */
var $cli_summary= "Manage server base objects";
/* Get userinfo & acls */
$this->ui = get_userinfo();
- /* Set up the users ACL's for this 'dn' */
- $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
- $this->acl= get_module_permission($acl, "goSpamServer", $this->ui->dn);
-
/* Get Flags */
foreach($this->Flags as $flag){
$var = "saFlags".$flag;
function execute()
{
+ $display ="";
$smarty = get_smarty();
- if(get_class($this->parent) == "servtabs"){
-
- $smarty->assign("servtabs",true);
- /* Do we need to flip is_account state? */
- if (isset($_POST['modify_state'])) {
- $this->is_account = !$this->is_account;
- }
+
+ /* If displayed, it is ever true*/
+ $this->is_account =true;
- /* Show tab dialog headers */
- if ($this->is_account) {
- /* call Add Acoount to add account */
- $display = $this->show_header(_("Remove spamassassin extension"),
- _("This server has spamassassin features enabled. You can disable them by clicking below."));
- } else {
- /* call remove Account */
- $display = $this->show_header(_("Add spamassassin service"),
- _("This server has spamassassin features disabled. You can enable them by clicking below."));
- return ($display);
- }
- }else{
- $this->is_account =true;
- $display ="";
- $smarty->assign("servtabs",false);
+ /* Get acls */
+ $tmp = $this->plinfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->getacl($name));
}
-
+
/* Add new trusted network */
- if(isset($_POST['AddNewTrust'])){
+ if(isset($_POST['AddNewTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
$this->AddTrust($_POST['NewTrustName']);
}
/* Delete selected trusted network */
- if(isset($_POST['DelTrust'])){
+ if(isset($_POST['DelTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
$this->DelTrust($_POST['TrustedNetworks']);
}
/* Add a new rule */
- if(isset($_POST['AddRule'])){
+ if(isset($_POST['AddRule']) && $this->acl_is_writeable("saRule")){
$this->dialog = new goSpamServerRule($this->config,$this->dn);
}
/* Handle post to delete rules */
$once = true;
foreach($_POST as $name => $value){
- if(preg_match("/^editRule_/",$name) && $once ){
+ if(preg_match("/^editRule_/",$name) && $once && $this->acl_is_readable("saRule")){
$once = false;
$entry = preg_replace("/^editRule_/","",$name);
$entry = preg_replace("/_(x|y)$/","",$entry);
$name = $entry;
$this->dialog = new goSpamServerRule($this->config,$this->dn,$name,$rule);
}
- if(preg_match("/^delRule_/",$name) && $once ){
+ if(preg_match("/^delRule_/",$name) && $once && $this->acl_is_writeable("saRule")){
$once = false;
$entry = preg_replace("/^delRule_/","",$name);
$entry = preg_replace("/_(x|y)$/","",$entry);
foreach($msgs as $msg){
print_red($msg);
}
- }else{
+ }elseif($this->acl_is_writeable("saRule")){
$ret = $this->dialog->save();
if((!empty($ret['orig_name'])) && isset($this->Rules[$ret['orig_name']])){
unset($this->Rules[$ret['orig_name']]);
/* Assign smarty vars */
foreach($this->attributes as $attr){
$smarty->assign($attr,$this->$attr);
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
}
/* Assign checkbox states */
foreach($this->Flags as $Flag){
$var = "saFlags".$Flag;
- $smarty->assign("saFlags".$Flag."ACL",chkacl($this->acl,$Flag));
+ $smarty->assign("saFlags".$Flag."ACL", $this->getacl($Flag));
if($this->$var){
$smarty->assign("saFlags".$Flag."CHK"," checked " );
}else{
$DivRules = new divSelectBox("SpamRules");
$DivRules->SetHeight(130);
- if(preg_match("/disabled/",chkacl($this->acl,"saTrustedNetworks"))){
+ if($this->acl_is_writeable("saTrustedNetworks")){
$actions = "";
}else{
+
$actions = "<input type='image' src='images/edit.png' name='editRule_%s'>";
- $actions.= "<input type='image' src='images/edittrash.png' name='delRule_%s'>";
+ if($this->acl_is_writeable("saRule")){
+ $actions.= "<input type='image' src='images/edittrash.png' name='delRule_%s'>";
+ }
}
foreach($this->Rules as $key => $net){
}
}
-
- /* remove this extension */
- function remove_from_parent()
- {
-
- if(!$this->is_account && $this->initially_was_account){
-
- plugin::remove_from_parent();
-
- /* Remove status flag, it is not a memeber of
- this->attributes, so ensure that it is deleted too */
- if(!empty($this->StatusFlag)){
- $this->attrs[$this->StatusFlag] = array();
- }
-
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/spamassassin with dn '%s' failed."),$this->dn));
- $this->handle_post_events("remove");
- }
- }
-
-
function save()
{
if(!$this->is_account) return;
}
- /* Return plugin informations for acl handling
+ /* Return plugin informations for acl handling */
function plInfo()
{
return (array(
"saFlagP" => _("Enable use of Pyzor"))
));
}
- */
/* For newer service management dialogs */
function getListEntry()
{
- $this->updateStatusState();
- $flag = $this->StatusFlag;
- $fields['Status'] = $this->$flag;
+ $fields = goService::getListEntry();
$fields['Message'] = _("Spamassassin");
- $fields['AllowStart'] = true;
- $fields['AllowStop'] = true;
- $fields['AllowRestart'] = true;
- $fields['AllowRemove'] = true;
$fields['AllowEdit'] = true;
return($fields);
}
-
- function updateStatusState()
- {
- if(empty($this->StatusFlag)) return;
-
- $attrs = array();
- $flag = $this->StatusFlag;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->cn);
- $ldap->cat($this->dn,array($flag));
- if($ldap->count()){
- $attrs = $ldap->fetch();
- }
- if(isset($attrs[$flag][0])){
- $this->$flag = $attrs[$flag][0];
- }
- }
- function action_hook($add_attrs= array())
- {
- /* Find postcreate entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK");
- }
- if ($command != ""){
- /* Walk through attribute list */
- foreach ($this->attributes as $attr){
- if (!is_array($this->$attr)){
- $command= preg_replace("/%$attr/", $this->$attr, $command);
- }
- }
- $command= preg_replace("/%dn/", $this->dn, $command);
- /* Additional attributes */
- foreach ($add_attrs as $name => $value){
- $command= preg_replace("/%$name/", $value, $command);
- }
-
- /* If there are still some %.. in our command, try to fill these with some other class vars */
- if(preg_match("/%/",$command)){
- $attrs = get_object_vars($this);
- foreach($attrs as $name => $value){
- if(!is_string($value)) continue;
- $command= preg_replace("/%$name/", $value, $command);
- }
- }
-
- if (check_command($command)){
- @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
- $command, "Execute");
-
- exec($command);
- } else {
- $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
- print_red ($message);
- }
- }
- }
-
- /* Directly save new status flag */
- function setStatus($value)
- {
- if($value == "none") return;
- if(!$this->initially_was_account) return;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
-
- $tmp = $ldap->fetch();
- for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
- $attrs['objectClass'][] = $tmp['objectClass'][$i];
- }
- $flag = $this->StatusFlag;
- $attrs[$flag] = $value;
- $this->$flag = $value;
- $ldap->modify($attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/spamassassin with dn '%s' failed."),$this->dn));
- $this->action_hook();
- }
- }
-
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/admin/systems/class_goTerminalServer.inc b/plugins/admin/systems/class_goTerminalServer.inc
index 6fcb615edbc44e5516e7c460ded0a4e0dbba42be..d6fa3ac935e2b4d0c276e8362fec67a4a949163f 100644 (file)
<?php
-class goTerminalServer extends plugin{
+require_once("class_goService.inc");
+
+class goTerminalServer extends goService{
var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
var $cli_description = "Some longer text\nfor help";
function execute()
{
- $smarty = get_smarty();
+ $smarty = get_smarty();
+
+ $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);
- $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
}
return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
}
function getListEntry()
{
- $this->updateStatusState();
- $flag = $this->StatusFlag;
- $fields['Status'] = $this->$flag;
+ $fields = goService::getListEntry();
$fields['Message'] = _("Terminal service");
- $fields['AllowStart'] = true;
- $fields['AllowStop'] = true;
- $fields['AllowRestart'] = true;
- $fields['AllowRemove']= true;
$fields['AllowEdit'] = true;
return($fields);
}
- function remove_from_parent()
- {
- plugin::remove_from_parent();
-
- /* Remove status flag, it is not a memeber of
- this->attributes, so ensure that it is deleted too */
- if(!empty($this->StatusFlag)){
- $this->attrs[$this->StatusFlag] = array();
- }
-
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error(), sprintf(_("Removing server services/terminalServer with dn '%s' failed."),$this->dn));
- $this->handle_post_events("remove");
- }
-
-
function save()
{
plugin::save();
}
- /* Directly save new status flag */
- function setStatus($value)
- {
- if($value == "none") return;
- if(!$this->initially_was_account) return;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
-
- $tmp = $ldap->fetch();
- for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
- $attrs['objectClass'][] = $tmp['objectClass'][$i];
- }
- $flag = $this->StatusFlag;
- $attrs[$flag] = $value;
- $this->$flag = $value;
- $ldap->modify($attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/terminalServer with dn '%s' failed."),$this->dn));
- $this->action_hook();
- }
- }
-
-
function check()
{
$message = plugin::check();
}
}
- function action_hook($add_attrs= array())
- {
- /* Find postcreate entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK");
- }
- if ($command != ""){
- /* Walk through attribute list */
- foreach ($this->attributes as $attr){
- if (!is_array($this->$attr)){
- $command= preg_replace("/%$attr/", $this->$attr, $command);
- }
- }
- $command= preg_replace("/%dn/", $this->dn, $command);
- /* Additional attributes */
- foreach ($add_attrs as $name => $value){
- $command= preg_replace("/%$name/", $value, $command);
- }
-
- /* If there are still some %.. in our command, try to fill these with some other class vars */
- if(preg_match("/%/",$command)){
- $attrs = get_object_vars($this);
- foreach($attrs as $name => $value){
- if(!is_string($value)) continue;
- $command= preg_replace("/%$name/", $value, $command);
- }
- }
-
- if (check_command($command)){
- @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
- $command, "Execute");
-
- exec($command);
- } else {
- $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
- print_red ($message);
- }
- }
- }
-
-
- /* Get updates for status flag */
- function updateStatusState()
- {
- if(empty($this->StatusFlag)) return;
-
- $attrs = array();
- $flag = $this->StatusFlag;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->cn);
- $ldap->cat($this->dn,array($flag));
- if($ldap->count()){
- $attrs = $ldap->fetch();
- }
- if(isset($attrs[$flag][0])){
- $this->$flag = $attrs[$flag][0];
- }
- }
- /* Return plugin informations for acl handling */
+ /* Return plugin informations for acl handling */
function plInfo()
{
return (array(
index 1158d55317d9aaf2b7c4df89fae26be35e1aa3ef..99e408f1cf2cb83ef588623fcf7d1f1aff7ab8f8 100644 (file)
-<table style='width:100%;'>
+<table style='width:100%'>
<tr>
<td style='width:50%;vertical-align:top;'><h2>Spam tagging</h2>
{t}Rewrite header{/t}
</td>
<td>
- <input type='text' name='saRewriteHeader' value='{$saRewriteHeader}' {$saRewriteHeaderACL}>
+{render acl=$saRewriteHeaderACL}
+ <input type='text' name='saRewriteHeader' value='{$saRewriteHeader}'>
+{/render}
</td>
</tr>
<tr>
{t}Required score{/t}
</td>
<td>
+{render acl=$saRequiredScoreACL}
<select name='saRequiredScore' title='{t}Select required score to tag mail as spam{/t}'>
{html_options options=$SpamScore selected=$saRequiredScore}
</select>
+{/render}
</td>
</tr>
</table>
<table width='100%'>
<tr>
<td>
- <select name='TrustedNetworks[]' size=4 style='width:100%;' multiple {$saTrustedNetworksACL}>
+{render acl=$saTrustedNetworksACL}
+ <select name='TrustedNetworks[]' size=4 style='width:100%;' multiple>
{html_options options=$TrustedNetworks}
</select><br>
- <input type='text' {$saTrustedNetworksACL} name='NewTrustName' value=''>
- <input type='submit' {$saTrustedNetworksACL} name='AddNewTrust' value='{t}Add{/t}'>
- <input type='submit' {$saTrustedNetworksACL} name='DelTrust' value='{t}Remove{/t}'>
+{/render}
+{render acl=$saTrustedNetworksACL}
+ <input type='text' name='NewTrustName' value=''>
+{/render}
+{render acl=$saTrustedNetworksACL}
+ <input type='submit' name='AddNewTrust' value='{t}Add{/t}'>
+{/render}
+{render acl=$saTrustedNetworksACL}
+ <input type='submit' name='DelTrust' value='{t}Remove{/t}'>
+{/render}
</td>
</tr>
</table>
<table>
<tr>
<td>
- <input type='checkbox' {$saFlagsBACL} name='saFlagsB' value='1' {$saFlagsBCHK}> {t}Enable use of bayes filtering{/t}<br>
- <input type='checkbox' {$saFlagsbACL} name='saFlagsb' value='1' {$saFlagsbCHK}> {t}Enable bayes auto learning{/t}<br>
- <input type='checkbox' {$saFlagsCACL} name='saFlagsC' value='1' {$saFlagsCCHK}> {t}Enable RBL checks{/t}
+{render acl=$saFlagsBACL}
+ <input type='checkbox' name='saFlagsB' value='1' {$saFlagsBCHK}> {t}Enable use of bayes filtering{/t}<br>
+{/render}
+{render acl=$saFlagsbACL}
+ <input type='checkbox' name='saFlagsb' value='1' {$saFlagsbCHK}> {t}Enable bayes auto learning{/t}<br>
+{/render}
+{render acl=$saFlagsCACL}
+ <input type='checkbox' name='saFlagsC' value='1' {$saFlagsCCHK}> {t}Enable RBL checks{/t}
+{/render}
</td>
</tr>
</table>
<table>
<tr>
<td>
- <input type='checkbox' {$saFlagsRACL} name='saFlagsR' value='1' {$saFlagsRCHK}> {t}Enable use of Razor{/t}<br>
- <input type='checkbox' {$saFlagsDACL} name='saFlagsD' value='1' {$saFlagsDCHK}> {t}Enable use of DDC{/t}<br>
- <input type='checkbox' {$saFlagsPACL} name='saFlagsP' value='1' {$saFlagsPCHK}> {t}Enable use of Pyzor{/t}
+{render acl=$saFlagsRACL}
+ <input type='checkbox' name='saFlagsR' value='1' {$saFlagsRCHK}> {t}Enable use of Razor{/t}<br>
+{/render}
+{render acl=$saFlagsDACL}
+ <input type='checkbox' name='saFlagsD' value='1' {$saFlagsDCHK}> {t}Enable use of DDC{/t}<br>
+{/render}
+{render acl=$saFlagsPACL}
+ <input type='checkbox' name='saFlagsP' value='1' {$saFlagsPCHK}> {t}Enable use of Pyzor{/t}
+{/render}
</td>
</tr>
</table>
<tr>
<td colspan='2'><h2>Rules</h2>
- <table width='100%;'>
+ <table width='100%'>
<tr>
<td>
+{render acl=$saTrustedNetworksACL}
{$divRules}<br>
- <input type='submit' name='AddRule' value='{t}Add{/t}' {$saTrustedNetworksACL}>
+{/render}
+{render acl=$saTrustedNetworksACL}
+ <input type='submit' name='AddRule' value='{t}Add{/t}'>
+{/render}
</td>
</tr>
</table>
</table>
<input type='hidden' value='1' name='goSpamServer'>
-{if !$servtabs}
<p class='seperator'> </p>
-<p>
<div style="width:100%; text-align:right;">
+<p>
<input type='submit' name='SaveService' value='{t}Save{/t}'>
<input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
</p>
-{/if}
+</div>
diff --git a/plugins/admin/systems/goTerminalServer.tpl b/plugins/admin/systems/goTerminalServer.tpl
index ebe86e94971bd2b19138a2a38bd18416258e4c44..524640f6c0d38a76e3ee65d0fd42bcdd00503820 100644 (file)
<table summary="">
<tr>
<td colspan=2>
- <input type="checkbox" value="true" name="goXdmcpIsEnabled" {$goXdmcpIsEnabledACL}
- id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>{t}Temporary disable login{/t}</td>
+{render acl=$goXdmcpIsEnabledACL}
+ <input type="checkbox" value="true" name="goXdmcpIsEnabled" id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>
+{/render}
+ {t}Temporary disable login{/t}
+ </td>
</tr>
<tr>
<td>{t}Font path{/t}</td>
- <td> <input type="text" value="{$goFontPath}" name="goFontPath" {$goXdmcpIsEnabledACL} id="FontPathId"></td>
+ <td>
+{render acl=$goXdmcpIsEnabledACL}
+ <input type="text" value="{$goFontPath}" name="goFontPath" {$goXdmcpIsEnabledACL} id="FontPathId">
+{/render}
+ </td>
</tr>
</table>
<p class='seperator'> </p>
-<p>
<div style="width:100%; text-align:right;">
+<p>
<input type='submit' name='SaveService' value='{t}Save{/t}'>
<input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
</p>
+</div>
<input type="hidden" name="goTerminalServerPosted" value="1">