X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup%2Fclass_setupStep_Ldap.inc;h=b2c467ef646c48fa7c29bb9057e78ad79382c149;hb=2dd0610553775a07cd552ccdcbbf650a18794a8c;hp=3e3bc899a12e63b904c61afa50d668445665974d;hpb=bf462dc5c237b48cdad12a5393ec2afe8e519902;p=gosa.git diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc index 3e3bc899a..b2c467ef6 100644 --- a/setup/class_setupStep_Ldap.inc +++ b/setup/class_setupStep_Ldap.inc @@ -20,13 +20,15 @@ */ -class setup_step_4 extends setup_step +class Step_Ldap extends setup_step { var $connection = "ldap://localhost:389"; var $location = "default"; var $admin = ""; var $password = ""; var $base = ""; + var $append_base_to_admin_dn = FALSE; + var $admin_given = ""; var $connect_id = FALSE; var $bind_id = FALSE; @@ -35,10 +37,12 @@ class setup_step_4 extends setup_step var $resolve_user = FALSE; var $tls = FALSE; - var $attributes = array("connection","location","admin","password","base","tls"); + var $rfc2307bis = FALSE; + var $attributes = array("connection","location","admin","password","base","admin_given","append_base_to_admin_dn","tls","rfc2307bis"); + var $header_image= "images/proxy.png"; - function setup_step_4() + function Step_Ldap() { $this->update_strings(); } @@ -46,9 +50,9 @@ class setup_step_4 extends setup_step function update_strings() { - $this->s_title = _("Ldap settings"); - $this->s_title_long = _("Ldap connection setup"); - $this->s_info = _("This dialog allows the basic configuration of GOsa's behaviour and properties in your main configuration."); + $this->s_title = _("LDAP setup"); + $this->s_title_long = _("LDAP connection setup"); + $this->s_info = _("This dialog performs the basic configuration of the LDAP connectivity for GOsa."); } @@ -77,7 +81,7 @@ class setup_step_4 extends setup_step $smarty->assign("resolved_users_count",count($tmp)); $smarty->assign("resolve_filter",$this->resolve_filter); } - return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl"))); + return($smarty -> fetch (get_template_path("../setup/setup_ldap.tpl"))); } function get_connection_status() @@ -99,10 +103,10 @@ class setup_step_4 extends setup_step return("".$str.""); }else{ if(empty($this->admin)){ - $str = sprintf(_("Anonymous bind successful on server '%s'. Please specify user and password."),$this->connection); - return("".$str.""); + $str = sprintf(_("Anonymous bind on server '%s' succeeded."), $this->connection); + return("".$str." "._("Please specify user and password.").""); }else{ - $str = sprintf(_("Bind as user '%s' successful on server '%s'."),$this->admin,$this->connection); + $str = sprintf(_("Bind as user '%s' on server '%s' succeeded."),$this->admin,$this->connection); return("".$str.""); } } @@ -117,7 +121,7 @@ class setup_step_4 extends setup_step $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))"); $tmp = array(); while($attrs = $ldap->fetch()){ - $tmp[$attrs['dn']]=$attrs['dn']; + $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']); natcasesort($tmp); } return($tmp); @@ -126,34 +130,71 @@ class setup_step_4 extends setup_step function save_object() { + $reset = FALSE; foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ - $this->$attr = $_POST[$attr]; + if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){ + $reset = TRUE; + } + $this->$attr = get_post($attr); } } + if($reset){ + $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) +1); + $attr = @LDAP::get_naming_contexts($this->connection); + if(is_array($attr) && !in_array(get_post("base"),$attr)){ + if(isset($attr[0])){ + $this->base = $attr[0]; + } + } + } + + if(isset($_POST['resolve_user_x'])){ + $this->resolve_user = !$this->resolve_user; + } if(isset($_POST['resolve_user'])){ $this->resolve_user = !$this->resolve_user; } - + + /* Hide backward forward button*/ + $this->dialog = $this->resolve_user; + if(isset($_POST['resolve_filter'])){ - $this->resolve_filter = $_POST['resolve_filter']; + $this->resolve_filter = get_post('resolve_filter'); } if(isset($_POST['use_selected_user'])){ if(isset($_POST['admin_to_use'])){ - $this->admin = $_POST['admin_to_use']; + $this->admin = base64_decode(get_post('admin_to_use')); $this->resolve_user = false; } } + if(isset($_POST['append_base_to_admin_dn'])){ + $this->append_base_to_admin_dn = TRUE; + }else{ + $this->append_base_to_admin_dn = FALSE; + } + + if($this->append_base_to_admin_dn){ + $base = $this->base; + if(!preg_match("/,$/",$this->admin_given)){ + $base = ",".$base; + } + $this->admin = $this->admin_given.$base; + }else{ + $this->admin = $this->admin_given; + } + $this->get_connection_status(); - if($this->bind_id){ + if($this->bind_id && !empty($this->admin) && !empty($this->base)){ $this->is_completed =TRUE; }else{ $this->is_completed =FALSE; } + } }