From 73511ba872b5dece11d54624702744f57ed6e6d3 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 5 Sep 2007 09:20:51 +0000 Subject: [PATCH] Exclude dhcp settings from existence check for given cn when creating new objects . git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7224 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_componentGeneric.inc | 3 +++ plugins/admin/systems/class_phoneGeneric.inc | 5 +++++ plugins/admin/systems/class_printGeneric.inc | 3 +++ plugins/admin/systems/class_servGeneric.inc | 2 +- plugins/admin/systems/class_terminalGeneric.inc | 2 +- plugins/admin/systems/class_winGeneric.inc | 3 +++ plugins/admin/systems/class_workstationGeneric.inc | 2 +- 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc index 5b100d469..2e65dccb0 100644 --- a/plugins/admin/systems/class_componentGeneric.inc +++ b/plugins/admin/systems/class_componentGeneric.inc @@ -170,6 +170,9 @@ class componentGeneric extends plugin $ldap->search ("(cn=".$this->cn.")", array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ + if(preg_match("/cn=dhcp,/",$attrs['dn'])){ + continue; + } if ($attrs['dn'] != $this->orig_dn){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc index 2c0eaaf87..5faf9ce2b 100644 --- a/plugins/admin/systems/class_phoneGeneric.inc +++ b/plugins/admin/systems/class_phoneGeneric.inc @@ -316,6 +316,11 @@ class phoneGeneric extends plugin $ldap->search ("(cn=".$this->cn.")", array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ + + if(preg_match("/cn=dhcp,/",$attrs['dn'])){ + continue; + } + if ($attrs['dn'] != $this->orig_dn){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 12c043c25..12b80670e 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -665,6 +665,9 @@ class printgeneric extends plugin $ldap->ls("(cn=".$this->cn.")","ou=printers,ou=systems,".$this->base, array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ + if(preg_match("/cn=dhcp,/",$attrs['dn'])){ + continue; + } if ($attrs['dn'] != $this->orig_dn){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index 55c4f425c..d730adafe 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -259,7 +259,7 @@ class servgeneric extends plugin if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ if ($attrs['dn'] != $this->orig_dn){ - if(!preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){ + if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; } diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index e41528791..dcfce668c 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -436,7 +436,7 @@ class termgeneric extends plugin /* Check if there are some other terminals found */ if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match ("/,ou=incoming,/", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc index 6fe4b7608..d73f766a8 100644 --- a/plugins/admin/systems/class_winGeneric.inc +++ b/plugins/admin/systems/class_winGeneric.inc @@ -181,6 +181,9 @@ class wingeneric extends plugin $ldap->search ("(cn=".$this->cn.")", array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ + if(preg_match("/cn=dhcp,/",$attrs['dn'])){ + continue; + } if ($attrs['dn'] != $this->orig_dn){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 37742181f..341dc15a8 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -397,7 +397,7 @@ class workgeneric extends plugin } if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match ("/,ou=incoming,/", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ -- 2.30.2