From f09bbee3265916598df06229de8ba974d062f39a Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 10 May 2010 13:33:19 +0000 Subject: [PATCH] Updated get_ou it receives values from the config registry now. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18277 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/class_printGeneric.inc | 28 +++++++++---------- .../systems/goto/class_terminalGeneric.inc | 14 +++++----- .../systems/goto/class_terminalService.inc | 20 ++++++------- .../systems/goto/class_workstationGeneric.inc | 12 ++++---- .../systems/goto/class_workstationService.inc | 20 ++++++------- .../systems/goto/class_workstationStartup.inc | 6 ++-- .../goto/admin/systems/goto/tabs_printers.inc | 2 +- .../goto/admin/systems/goto/tabs_terminal.inc | 2 +- .../admin/systems/goto/tabs_workstation.inc | 2 +- 9 files changed, 53 insertions(+), 53 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index c420b2f1d..39746e916 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -71,11 +71,11 @@ class printgeneric extends plugin /* Update dn, to ensure storing as printer instead of WS / terminal */ if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } $this->orig_dn = $this->dn; @@ -104,10 +104,10 @@ class printgeneric extends plugin } else { /* Set base and check if the extracted base exists */ - if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->dn)){ - $this->base= preg_replace("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i","",dn2base($this->dn)); + if(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->dn)){ + $this->base= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i","",dn2base($this->dn)); }else{ - $this->base= preg_replace("/".preg_quote(get_ou('printerRDN'), '/')."/i","",dn2base($this->dn)); + $this->base= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i","",dn2base($this->dn)); } if(!isset($this->config->idepartments[$this->base])){ @@ -256,11 +256,11 @@ class printgeneric extends plugin /* Update dn, to ensure storing as printer instead of WS / terminal */ if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } /* Detect if this is a valid printer account; @@ -625,11 +625,11 @@ class printgeneric extends plugin /* Update dn, to ensure storing as printer instead of WS / terminal */ if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/').",/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/').",/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } /* Check if this dn points to a printer, to avoid deleting something else */ @@ -727,7 +727,7 @@ class printgeneric extends plugin } } - $dn= "cn=".$this->cn.get_ou('printerRDN').",".$this->base; + $dn= "cn=".$this->cn.get_ou("workgeneric", "workstationRDN") .",".$this->base; /* must: cn */ if(($this->BelongsTo == "Printer") && $this->cn == ""){ @@ -753,7 +753,7 @@ class printgeneric extends plugin if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){ $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->base); - $ldap->ls("(cn=".$this->cn.")",get_ou('printerRDN').$this->base, array("cn")); + $ldap->ls("(cn=".$this->cn.")",get_ou("workgeneric", "workstationRDN") .$this->base, array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ if(preg_match("/cn=dhcp,/",$attrs['dn'])){ @@ -785,11 +785,11 @@ class printgeneric extends plugin /* Update dn, to ensure storing as printer instead of WS / terminal */ if(preg_match("/terminal/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } if(preg_match("/workstation/i",$this->BelongsTo)){ - $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn); + $this->dn= preg_replace("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",get_ou("workgeneric", "workstationRDN") ,$this->dn); } if(!$this->is_account) return; @@ -921,7 +921,7 @@ class printgeneric extends plugin } /* Ensure to create a new object */ - if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->orig_dn)){ + if(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->orig_dn)){ $this->orig_dn = "new"; } diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc index 6564b864c..374b41133 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc @@ -125,10 +125,10 @@ class termgeneric extends plugin if ($this->dn == "new"){ $ui= get_userinfo(); $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn); - } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){ - $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn); + } elseif(preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", $this->dn)){ + $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn); } else { - $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn); + $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn); } /* Create an array of all Syslog servers */ @@ -420,7 +420,7 @@ class termgeneric extends plugin } /* Permissions for that base? */ - $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base; + $this->dn= "cn=".$this->cn.",".get_ou("ArpNewDevice", "systemIncomingRDN") .$this->base; if ($this->cn == ""){ $message[]= msgPool::required(_("Name")); @@ -448,7 +448,7 @@ class termgeneric extends plugin } if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ @@ -493,7 +493,7 @@ class termgeneric extends plugin $ldap= $this->config->get_ldap_link(); /* Strip relevant part from dn, keep trailing ',' */ - $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn); + $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN") , '/')."/i", "", $this->dn); $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); /* Walk from top to base and try to load default values for @@ -501,7 +501,7 @@ class termgeneric extends plugin while (TRUE){ $tmp= preg_replace ("/^[^,]+,/", "", $tmp); - $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp. + $ldap->cat("cn=default,".get_ou("ArpNewDevice", "systemIncomingRDN") .$tmp. $this->config->current['BASE'], array('gotoTerminalPath')); $attrs= $ldap->fetch(); if (isset($attrs['gotoTerminalPath'])){ diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc index 28846fd50..a7d91c1dd 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc @@ -198,7 +198,7 @@ class termservice extends plugin /* Load phone hardware list */ - $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")), + $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("group", "ogroupRDN") ), $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK); foreach($tmp as $attrs){ $cn= $attrs['cn'][0]; @@ -216,13 +216,13 @@ class termservice extends plugin */ $deps_a = array( get_people_ou(), - get_ou("ogroupRDN"), - get_ou("serverRDN"), - get_ou("terminalRDN"), - get_ou("workstationRDN"), - get_ou("printerRDN"), - get_ou("componentRDN"), - get_ou("phoneRDN")); + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") ); $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'], array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK); @@ -650,7 +650,7 @@ class termservice extends plugin */ $p = $this->parent->by_object['ogroup']; foreach($p->memberList as $dn => $obj){ - if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue; + if(preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$dn)) continue; if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){ $macs[] = $p->objcache[$dn]['macAddress']; } @@ -660,7 +660,7 @@ class termservice extends plugin /* We are a workstation. Add current mac. */ $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress; - if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){ + if(!empty($mac) && !preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$this->orig_dn)){ $macs[] = $mac; } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc index b5ff4338c..53f4324dd 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc @@ -141,10 +141,10 @@ class workgeneric extends plugin if ($this->dn == "new"){ $ui= get_userinfo(); $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn); - } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){ - $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn); + } elseif(preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", $this->dn)){ + $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", "", $this->dn); }else{ - $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workstationRDN"), '/')."/i", "", $this->dn); + $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", "", $this->dn); } /* Create an array of all Syslog servers */ @@ -429,7 +429,7 @@ class workgeneric extends plugin $message= array_merge($message, $this->netConfigDNS->check()); } - $this->dn= "cn=".$this->cn.",".get_ou('workstationRDN').$this->base; + $this->dn= "cn=".$this->cn.",".get_ou("workgeneric", "workstationRDN") .$this->base; if ($this->cn == ""){ $message[]= msgPool::required(_("Name")); @@ -456,7 +456,7 @@ class workgeneric extends plugin } if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ @@ -486,7 +486,7 @@ class workgeneric extends plugin }else{ /* Warn the user, that this host is currently installing */ if($this->currently_installing && !$this->currently_installing_warned && - !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i",$this->orig_dn)){ + !preg_match("/".preg_quote(get_ou("workgeneric", "workstationRDN") , '/')."/i",$this->orig_dn)){ /* Force aborting without message dialog */ $message[] = ""; diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc index 4b131ec53..b2e4cc281 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc @@ -137,7 +137,7 @@ class workservice extends plugin /* Load phone hardware list */ - $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")), + $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("group", "ogroupRDN") ), $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK); foreach($tmp as $attrs){ $cn= $attrs['cn'][0]; @@ -155,13 +155,13 @@ class workservice extends plugin */ $deps_a = array( get_people_ou(), - get_ou("ogroupRDN"), - get_ou("serverRDN"), - get_ou("terminalRDN"), - get_ou("workstationRDN"), - get_ou("printerRDN"), - get_ou("componentRDN"), - get_ou("phoneRDN")); + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") , + get_ou("group", "ogroupRDN") ); $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'], array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK); @@ -544,7 +544,7 @@ class workservice extends plugin */ $p = $this->parent->by_object['ogroup']; foreach($p->memberList as $dn => $obj){ - if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue; + if(preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$dn)) continue; if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){ $macs[] = $p->objcache[$dn]['macAddress']; } @@ -554,7 +554,7 @@ class workservice extends plugin /* We are a workstation. Add current mac. */ $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress; - if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){ + if(!empty($mac) && !preg_match("/".preg_quote(get_ou("group", "ogroupRDN") , '/')."/",$this->orig_dn)){ $macs[] = $mac; } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc index d28a4b201..894f5e758 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc @@ -674,7 +674,7 @@ class workstartup extends plugin $ldap= $this->config->get_ldap_link(); /* Strip relevant part from dn, keep trailing ',' */ - $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn); + $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN") , '/')."/i", "", $this->dn); $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp); /* Walk from top to base and try to load default values for @@ -682,7 +682,7 @@ class workstartup extends plugin while (TRUE){ $tmp= preg_replace ("/^[^,]+,/", "", $tmp); - $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp. + $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN") .$tmp. $this->config->current['BASE'], array('gotoTerminalPath')); $attrs= $ldap->fetch(); if (isset($attrs['gotoTerminalPath'])){ @@ -1224,7 +1224,7 @@ class workstartup extends plugin */ function dn_to_release_name($dn) { - $relevant = preg_replace("/,".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$dn); + $relevant = preg_replace("/,".preg_quote(get_ou("termgeneric", "terminalRDN") , '/').".*$/i","",$dn); $parts = array_reverse(explode(",",$relevant)); $str =""; foreach($parts as $part){ diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc b/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc index 6a7e0e02d..cd93fa1b4 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_printers.inc @@ -81,7 +81,7 @@ class printtabs extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ $baseobject= $this->by_object['printgeneric']; - $this->dn= "cn=$baseobject->cn,".get_ou('printerRDN').$baseobject->base; + $this->dn= "cn=$baseobject->cn,".get_ou("printgeneric", "printerRDN") .$baseobject->base; $baseobject->dn= $this->dn; foreach ($this->by_object as $key => $obj){ diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc index b1adb9328..b016331a5 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc @@ -87,7 +87,7 @@ class termtabs extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ $baseobject= $this->by_object['termgeneric']; - $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base; + $this->dn= "cn=".$baseobject->cn.",".get_ou("termgeneric", "terminalRDN") .$baseobject->base; $baseobject->dn= $this->dn; if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){ diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc b/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc index 32bcaea5c..4d0a4e80a 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_workstation.inc @@ -86,7 +86,7 @@ class worktabs extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ $baseobject= $this->by_object['workgeneric']; - $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationRDN').$baseobject->base; + $this->dn= "cn=".$baseobject->cn.",".get_ou("workgeneric", "workstationRDN") .$baseobject->base; if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){ -- 2.30.2