summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 659c6ab)
raw | patch | inline | side by side (parent: 659c6ab)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 6 Feb 2007 11:09:31 +0000 (11:09 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 6 Feb 2007 11:09:31 +0000 (11:09 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5692 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_tabs.inc | patch | blob | history | |
plugins/admin/users/tabs_user.inc | patch | blob | history | |
plugins/personal/generic/class_user.inc | patch | blob | history |
diff --git a/include/class_tabs.inc b/include/class_tabs.inc
index 8e2d42ca4861c77d3dd7305f14edb0c3610c4ce8..0808b9abe2d0fa1f019e8cab6145a65fe8ea34b0 100644 (file)
--- a/include/class_tabs.inc
+++ b/include/class_tabs.inc
$obj->save_object ();
$this->by_object[$this->current]= $obj;
}
-
}
function gen_tabs()
index 25dfee8c2b39f5002680c0d6ce4cb4e33fdeaa1e..ecc70d05b982d0bec259cb88c6c23921a7795c19 100644 (file)
/* Add references/acls/snapshots */
$this->addSpecialTabs();
+
}
function save_object($save_current= FALSE)
'dn' to all plugins */
$baseobject= $this->by_object['user'];
- /* Assemble cn */
- $pt= "";
- if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
- if(!empty($baseobject->personalTitle)){
- $pt = $baseobject->personalTitle." ";
- }
- }
-
- if ($this->dn == 'new'){
- $baseobject->cn= $pt.$baseobject->givenName." ".$baseobject->sn;
- $this->by_object['user']= $baseobject;
- if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
- $this->dn= 'uid='.$baseobject->uid.','.get_people_ou().$baseobject->base;
- } else {
- $this->dn= 'cn='.$baseobject->cn.','.get_people_ou().$baseobject->base;
- }
- } // != 'new'
- else
- {
- /* Extract cn and compare with actual cn present in 'dn' */
- if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
- $new_dn= 'uid='.$baseobject->uid.','.get_people_ou().$baseobject->base;
- } else {
- $new_dn= "cn=".$pt.$baseobject->givenName." ".$baseobject->sn.','.
- get_people_ou().$baseobject->base;
- }
-
- /* Hickert: 31.08.2005
- * fixed error = Trying to overwrite cn=*** which already exists.
- * If you changed one of the "Name" / "Givenname" attributes to lower or upper case, like "test" to "Test", (in DNMODE=cn)
- * the old_dn and new dn were different. cn=test ... cn=Test ...
- * The following code decided to move the entry from old_dn to new_dn. (Because they differ)
- * But the ldap attribute cn is not case sensitive and the function plugin::move() quits with
- * an error, because source and destination dn are both the same (for ldap, but not for php).
- * This fix allow you to change the givenname or name attributes.
- */
- if(strtolower($this->dn)==strtolower($new_dn)){
- $this->dn=$new_dn;
- }
-
- if ($this->dn != $new_dn){
-
- /* Write entry on new 'dn' */
- $baseobject->cn= $pt.$baseobject->givenName." ".$baseobject->sn;
+ if ($this->dn != 'new'){
+ $new_dn= $baseobject->new_dn;
+ if (strtolower($this->dn) != strtolower($new_dn)){
/* Udpate acls */
$baseobject->update_acls($this->dn,$new_dn);
/* Did we change ourselves? Update ui object. */
change_ui_dn($this->dn, $new_dn);
-
- /* Happen to use the new one */
- $this->dn= $new_dn;
}
}
+
+ $this->dn= $baseobject->new_dn;
+
return tabs::save();
}
index bb0607a3eddc4b5e373658f199a86020a4444e75..b02dc292d0d784b007657b037aff418aa2bc1dbe 100644 (file)
/* Plugin specific values */
var $base= "";
var $cn= "";
+ var $new_dn= "";
var $personalTitle= "";
var $academicTitle= "";
var $homePostalAddress= "";
}
- /* Build new dn */
- if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
- $new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
- } else {
- $new_dn= 'cn='.$this->cn.','.get_people_ou().$this->base;
- }
-
/* This only gets called when user is renaming himself */
$ldap= $this->config->get_ldap_link();
- if ($this->dn != $new_dn){
+ if ($this->dn != $this->new_dn){
/* Write entry on new 'dn' */
- $this->update_acls($this->dn,$new_dn);
- $this->move($this->dn, $new_dn);
+ $this->update_acls($this->dn,$this->new_dn);
+ $this->move($this->dn, $this->new_dn);
/* Happen to use the new one */
- change_ui_dn($this->dn, $new_dn);
- $this->dn= $new_dn;
+ change_ui_dn($this->dn, $this->new_dn);
+ $this->dn= $this->new_dn;
}
/* Permissions for that base? */
if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
- $new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
+ $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
} else {
- $new_dn= 'cn='.$this->cn.','.get_people_ou().$this->base;
+ /* Don't touch dn, if cn hasn't changed */
+ if (isset($this->saved_attributes['cn']) && $this->saved_attributes['cn'] == $this->cn){
+ $this->new_dn= $this->dn;
+ } else {
+ $this->new_dn= $this->create_unique_dn('cn', get_people_ou().$this->base);
+ }
}
/* Set the new acl base */
$message[]= _("The required field 'Login' is not set.");
}
if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(cn=".$this->cn.")", array("uid"));
- $ldap->fetch();
- if ($ldap->count() != 0 && $this->dn != $new_dn && $this->dn == 'new'){
+ $ldap->cat($this->new_dn);
+ if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
$message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
}
}