diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
index 0e372ddefbd29d2127ec8217ee5a88eca7aaf4ad..e4749fb1fa02c9cec02b6d1a8e1c0cf8f7a89f61 100644 (file)
plugin::PrepareForCopyPaste($source);
$source_o = new workstartup ($this->config, $source['dn']);
foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem",
- "gotoKernelParameters","gotoShares") as $attr){
+ "gotoKernelParameters","gotoShares","gotoLdapServers", "gotoLdap_inherit") as $attr){
$this->$attr = $source_o->$attr;
}
}
));
}
+ /* Function to find bad classes */
+ function update_bad_classes($release)
+ {
+
+ if(!isset($this->cache['BAD_CLASSES'][$release])) {
+ /* Find "bad" classes */
+ $ui = get_userinfo();
+ $ldap = $this->config->get_ldap_link();
+
+ /* Convert release name to a valid ldap uri component */
+ $release_components = split('/', $release);
+ $release_components = array_reverse($release_components);
+ for($i=0;$i<sizeof($release_components);$i++) {
+ $release_components[$i] = "ou=" . $release_components[$i];
+ }
+ $release_dn_part = join(',', $release_components);
+
+ /* Limit the base to the release in the faiBase */
+ $base = sprintf("%s,%s%s", $release_dn_part, get_ou('faiBaseRDN'), $this->config->current['BASE']);
+
+ /* Build a list of all fai classes, that don't have the unittag of the user
+ * and are not freezed or removed. The classes will be filtered by this
+ * list. Its needed to specify each objectClass (FAIpackageList etc.) because
+ * FAIClass would match sub-objects, too, which would lead to an array that
+ * is much bigger then needed */
+ $filter = sprintf('(&(|(objectClass=FAItemplate)(objectClass=FAIpackageList)(objectClass=FAIprofile)(objectClass=FAIscript)(objectClass=FAIpartitionTable)(objectClass=FAIHook)(objectClass=FAIvariable)(objectClass=FAItemplate))(&(!(gosaUnitTag=%s))(&(!(FAIstate=*removed*))(!(FAIstate=*freeze*)))))', $ui->gosaUnitTag);
+ $ldap->cd($base);
+ $ldap->search(sprintf("$filter", $ui->gosaUnitTag));
+
+ $this->cache['BAD_CLASSES'][$release] = array();
+ while ($entry = $ldap->fetch()) {
+ $classname = $entry['cn'][0];
+ if (!in_array($classname, $this->cache['BAD_CLASSES'][$release])) {
+ array_push($this->cache['BAD_CLASSES'][$release], $classname);
+ }
+ }
+ }
+ }
/* Updates release dns
* and reads all classes for the current release,
return;
}else{
+ $base = $this->config->current['BASE'];
+ $ldap = $this->config->get_ldap_link();
foreach($servers as $server){
+ /* Dont show servers that have a different unittag as the user*/
+ $ui = get_userinfo();
+ if ($ui->gosaUnitTag != $server['TAG']) {
+ continue;
+ }
+
$rel = $server['FAI_RELEASE'];
$this->cache['SERVERS']['auto'][$rel] = $rel;
$this->cache['SERVERS'][$server['SERVER']][$rel] = $rel;
}else{
foreach($classes as $class){
$classname = $class['CLASS'];
+ $this->update_bad_classes($release);
+ if(isset($this->cache['BAD_CLASSES'][$release])){
+ /* Skip classes that are in the array of bad classes */
+ if (in_array($classname, $this->cache['BAD_CLASSES'][$release])) {
+ continue;
+ }
+ }
if (!isset($this->cache['CLASSES'][$release][$classname])) {
$this->cache['CLASSES'][$release][$classname] = array();
}