From: wolffc Date: Thu, 16 Sep 2010 14:35:53 +0000 (+0000) Subject: When moving or renaming devices, check whether they are in use by a X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=02ec057823faad6574f830dc85b98e430b24652a When moving or renaming devices, check whether they are in use by a user, group or object group. If so, display an error message stating the user. As the reference is not being updated in the user object, the device would get deleted from the user next time when they are saved. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19720 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/trunk/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc b/trunk/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc index d4d5043ca..cd83d097e 100644 --- a/trunk/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc +++ b/trunk/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc @@ -126,6 +126,21 @@ class deviceGeneric extends plugin $message[] = msgPool::permMove(); } + if ($this->cn != $this->orig_cn || $this->base != $this->orig_base) { + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".LDAP::prepare4filter($this->orig_dn)."))", + array("cn","uid")); + $obj = array(); + while($attrs = $ldap->fetch()){ + $obj[$ldap->getDN()]= $attrs['cn'][0]; + } + if ($obj != array()) { + $message[] = msgPool::stillInUse(_("Device"), $obj); + } + } + return($message); }