X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servDNS.inc;h=c74c27fd379fdbbfb0ba2364b557c533b4e46d9f;hb=99ee92a703ab07286a61eb0a094ef7e9b7f27730;hp=155966473306d485bf01ae25fd62d5d0b3ddf073;hpb=c39b66e0d18516a014b3267b60a40b772818c104;p=gosa.git diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index 155966473..c74c27fd3 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -1,6 +1,8 @@ DisplayName = _("Domain name system service"); + $this->DisplayName = _("DNS service"); $this->orig_dn = $dn; @@ -70,10 +72,10 @@ class servdns extends plugin } if ($this->is_account){ - $display= $this->show_header(_("Remove DNS service"), + $display= $this->show_disable_header(_("Remove DNS service"), _("This server has DNS features enabled. You can disable them by clicking below.")); } else { - $display= $this->show_header(_("Add DNS service"), + $display= $this->show_enable_header(_("Add DNS service"), _("This server has DNS features disabled. You can enable them by clicking below.")); return ($display); } @@ -210,14 +212,16 @@ class servdns extends plugin /* There are still entries using this configuration * Abort deletion - */ + */ if(count($used)){ $i = 2; $str =""; foreach($used as $dn){ - if($i > 0 ){ + if($i > 0 && !preg_match("/,relativeDomainName=/",$dn)){ $i --; - $str.=$dn." "; + $name = preg_replace("/^[^=]+=([^,]*),.*$/","\\1",$dn); + $zone = preg_replace("/^.*zoneName=([^,]*),.*$/","\\1",$dn); + $str.= $name.".".$zone." "; } } @@ -227,9 +231,10 @@ class servdns extends plugin $str .=" ... "; } print_red(sprintf(_("Can't delete the selected zone, because it is still in use by these entry/entries '%s'"),trim($str))); - + return(false); }else{ unset($this->Zones[$id]); + return(true); } } @@ -253,18 +258,17 @@ class servdns extends plugin */ function remove_from_parent() { - if(!$this->initially_was_account){ - return; - } - print_red("Can't remove dns yet. returning without remove."); - return; - $ldap = $this->config->get_ldap_link(); - $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=@))",$this->orig_dn,array("relativeDomainName","zoneName")); - while($attr = $ldap->fetch()){ - $ldap->cd($attr['dn']); - $ldap->rmDir($attr['dn']); + if($this->initially_was_account){ + $bool = true; + foreach($this->Zones as $key => $zone){ + $bool= $bool & $this->RemoveZone($key); + } + + if($bool){ + $this->save(); + } + return($bool); } - show_ldap_error($ldap->get_error(), _("Removing DNS service failed")); } @@ -285,7 +289,7 @@ class servdns extends plugin foreach($tmp['zoneUpdates'] as $dn => $attrs){ $ldap->cd($dn); $ldap->modify($attrs); - show_ldap_error("Zone:".$ldap->get_error(), _("Updating DNS service failed")); + show_ldap_error($ldap->get_error(), sprintf(_("Updating of system server/dns with dn '%s' failed."),$this->dn)); } } @@ -294,7 +298,7 @@ class servdns extends plugin foreach($tmp['del'] as $dn => $del){ $ldap->cd($dn); $ldap->rmdir_recursive($dn); - show_ldap_error($ldap->get_error(), _("Removing DNS entries failed")); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/dns with dn '%s' failed."),$this->dn)); } /* move follwoing entries @@ -315,7 +319,7 @@ class servdns extends plugin $ldap->cd($dn); $ldap->add($attrs); } - show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn)); } } @@ -325,6 +329,7 @@ class servdns extends plugin { if($value == "none") return; if(!$this->initially_was_account) return; + if(empty($this->StatusFlag)) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); @@ -338,7 +343,7 @@ class servdns extends plugin $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for system server/dns with dn '%s' failed."),$this->dn)); $this->action_hook(); } } @@ -346,18 +351,8 @@ class servdns extends plugin function getListEntry() { - $this->updateStatusState(); - $flag = $this->StatusFlag; - if(empty($flag)){ - $fields['Status'] = ""; - }else{ - $fields['Status'] = $this->$flag; - } + $fields = goService::getListEntry(); $fields['Message'] = _("DNS service"); - $fields['AllowStart'] = true; - $fields['AllowStop'] = true; - $fields['AllowRestart'] = true; - $fields['AllowRemove']= true; $fields['AllowEdit'] = true; return($fields); } @@ -380,6 +375,34 @@ class servdns extends plugin $this->$flag = $attrs[$flag][0]; } } + + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("DNS service"), + "plDescription" => _("DNS service")." ("._("Services").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 83, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "zoneName" =>_("Zone name"), + "ReverseZone" =>_("Reverse zone"), + "sOAprimary" =>_("Primary dns server"), + "sOAmail" =>_("Mail address"), + "sOAserial" =>_("Serial"), + "sOArefresh" =>_("Refresh"), + "sOAretry" =>_("Retry"), + "sOAexpire" =>_("Expire"), + "sOAttl" =>_("TTL"), + "zoneRecords" =>_("Zone records")) + )); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>