From dc0644afc89d8c56336a2524e199ae02f77284d0 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 28 Apr 2010 13:45:23 +0000 Subject: [PATCH] Updated several plugins -Applied bugfixes catched during testing trunk git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@17912 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_CopyPasteHandler.inc | 58 ++++++++++++++++++- gosa-core/include/class_userinfo.inc | 5 +- .../admin/departments/class_department.inc | 2 +- .../plugins/personal/generic/class_user.inc | 15 ++++- .../personal/posix/class_posixAccount.inc | 11 ++++ 5 files changed, 87 insertions(+), 4 deletions(-) diff --git a/gosa-core/include/class_CopyPasteHandler.inc b/gosa-core/include/class_CopyPasteHandler.inc index 4d6fb1ddb..9c87c0b37 100644 --- a/gosa-core/include/class_CopyPasteHandler.inc +++ b/gosa-core/include/class_CopyPasteHandler.inc @@ -352,6 +352,7 @@ class CopyPasteHandler { $this->lastdn = $this->current['object']->dn; $this->current= $this->_update_vars($this->current); $this->current['object']->save(); + $this->handleReferences(); $this->current = FALSE; } } @@ -368,6 +369,7 @@ class CopyPasteHandler { /* Load next queue entry */ if(!count($msgs)){ $this->current['object']->save(); + $this->handleReferences(); $this->lastdn = $this->current['object']->dn; $this->current = FALSE; }else{ @@ -415,7 +417,7 @@ class CopyPasteHandler { $smarty->assign("AttributesToFix",$this->generateAttributesToFix()); $smarty->assign("SubDialog",$this->current['object']->SubDialog); $smarty->assign("objectDN",$this->current['source_data']['dn']); - $smarty->assign("message", sprintf(_("This object will be pasted: %s"), "

".$this->current['source_data']['dn'])); + $smarty->assign("message", sprintf(_("This object will be pasted: %s"), "

".bold($this->current['source_data']['dn']))); return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE))); } } @@ -504,6 +506,60 @@ class CopyPasteHandler { } + function handleReferences() + { + $dst_dn = $this->current['object']->dn; + $src_dn = $this->current['dn']; + + // Only copy references if required + if($this->current['method'] != 'copy') return; + + // Migrate objectgroups + $ogroups = get_sub_list("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter(LDAP::fix($src_dn))."))", + "ogroups", array(get_ou("ogroupRDN")),$this->config->current['BASE'],array("dn"), GL_SUBSEARCH | GL_NO_ACL_CHECK); + + // Walk through all objectGroups + foreach($ogroups as $ogroup){ + $o_ogroup= new ogroup($this->config,$ogroup['dn']); + $o_ogroup->member[$dst_dn]= $dst_dn; + $o_ogroup->save(); + } + + // Update roles + $roles = get_sub_list("(&(objectClass=organizationalRole)(roleOccupant=".LDAP::prepare4filter(LDAP::fix($src_dn))."))", + "roles", array(get_ou("roleRDN")),$this->config->current['BASE'],array("dn"), GL_SUBSEARCH | GL_NO_ACL_CHECK); + + // Walk through all roles + foreach($roles as $role){ + $role = new roleGeneric($this->config,$role['dn']); + $role->roleOccupant[] = $dst_dn; + $role->save(); + } + + // Update groups + if(isset($this->current['object']->uid) && !empty($this->current['object']->uid)){ + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($src_dn); + $attrs = $ldap->fetch(); + if(isset($attrs['uid'][0])){ + $suid = $attrs['uid'][0]; + + $uid = $this->current['object']->uid; + $groups = get_sub_list("(&(objectClass=posixGroup)(memberUid={$suid}))", + "groups",array(get_ou("groupRDN")),$this->config->current['BASE'],array("dn"), GL_SUBSEARCH | GL_NO_ACL_CHECK); + + // Walk through all POSIX groups + foreach($groups as $group){ + $o_group= new group($this->config,$group['dn']); + $o_group->addUser($uid); + $o_group->save(); + } + } + } + } + /* returns the paste icon for headpages */ function generatePasteIcon() { diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index 1b5fac84e..fcfaae854 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -489,7 +489,10 @@ class userinfo foreach($this->ocMapping[$ocs] as $oc){ if (isset($subacl['acl'][$ocs.'/'.$oc])){ - if($dn != $this->dn && strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue; + // Skip ACLs wich are defined for ourselfs only - if not checking against ($ui->dn) + if(isset($subacl['acl'][$ocs.'/'.$oc][0]) && + $dn != $this->dn && + strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue; foreach($subacl['acl'][$ocs.'/'.$oc] as $attr => $dummy){ $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][$attr]); diff --git a/gosa-core/plugins/admin/departments/class_department.inc b/gosa-core/plugins/admin/departments/class_department.inc index 859ec3f9a..bdf658aab 100644 --- a/gosa-core/plugins/admin/departments/class_department.inc +++ b/gosa-core/plugins/admin/departments/class_department.inc @@ -230,7 +230,7 @@ class department extends plugin $this->baseSelector->setBases($tmp); foreach ($this->attributes as $val){ - $smarty->assign("$val", $this->$val); + $smarty->assign("$val", htmlentities($this->$val,ENT_COMPAT,'UTF-8')); } $smarty->assign("base", $this->baseSelector->render()); diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 9bf7f47c7..9d3f500a9 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -733,7 +733,6 @@ class user extends plugin while ($ldap->fetch()){ $og= new ogroup($this->config, $ldap->getDN()); unset($og->member[$this->dn]); - $og->member= array_values($og->member); $og->save (); } @@ -1630,6 +1629,20 @@ class user extends plugin $this->old_userPKCS12= ""; $this->old_userSMIMECertificate= ""; $this->old_userCertificate= ""; + + /* Generate dateOfBirth entry */ + if (isset ($source['dateOfBirth'])){ + list($year, $month, $day)= explode("-", $source['dateOfBirth'][0], 3); + $this->dateOfBirth= "$day.$month.$year"; + } else { + $this->dateOfBirth= ""; + } + + // Try to load the user picture + $tmp_dn = $this->dn; + $this->dn = $source['dn']; + $this->load_picture(); + $this->dn = $tmp_dn; } diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index 2bd4f5fac..6c31a1764 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -1425,6 +1425,17 @@ class posixAccount extends plugin $this->primaryGroup= $source['gidNumber'][0]; } + + /* Adjust shadow checkboxes */ + foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive", + "shadowExpire") as $val){ + + if ($this->$val != 0){ + $oval= "activate_".$val; + $this->$oval= "1"; + } + } + } -- 2.30.2