From 58415eb0fcf7ae30df5f4798ab546d51f7acd380 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Feb 2007 10:09:53 +0000 Subject: [PATCH] Updated setup git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5714 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/themes/default/style.css | 2 +- setup/class_setupStep4.inc | 57 ++++++++++++++++++++++++++++++----- setup/setup_step4.tpl | 23 ++++++++++++-- 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/html/themes/default/style.css b/html/themes/default/style.css index d4d6026a7..9b2952e10 100644 --- a/html/themes/default/style.css +++ b/html/themes/default/style.css @@ -1046,7 +1046,7 @@ li.step4_value, div.step4_value { } li.step4_status, div.step4_status { - text-align:right; + text-align:center; vertical-align: middle; overflow: hidden; height:2.0em; diff --git a/setup/class_setupStep4.inc b/setup/class_setupStep4.inc index bac087915..c1470837a 100644 --- a/setup/class_setupStep4.inc +++ b/setup/class_setupStep4.inc @@ -41,6 +41,9 @@ class setup_step_4 extends setup_step var $connect_id = FALSE; var $bind_id = FALSE; + var $resolve_filter = "*"; + var $resolve_user = FALSE; + var $attributes = array("connection","location","admin","password","base","peopleou","peopledn","groupou", "uidbase","encryption","mail","errors"); @@ -75,8 +78,15 @@ class setup_step_4 extends setup_step /* Assign connection status */ $smarty->assign("connection_status",$this->get_connection_status()); + /* Addign resolved users */ + $smarty->assign("resolve_user",$this->resolve_user); + if($this->resolve_user){ + $tmp = $this->resolve_user(); + $smarty->assign("resolved_users",$tmp); + $smarty->assign("resolved_users_count",count($tmp)); + $smarty->assign("resolve_filter",$this->resolve_filter); + } return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl"))); - } /* Returns the classnames auf the mail classes */ @@ -105,16 +115,16 @@ class setup_step_4 extends setup_step function get_connection_status() { - - + $this->connect_id = FALSE; + $this->bind_id = FALSE; @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); - $cid = @ldap_connect($this->connection); + $this->connect_id = @ldap_connect($this->connection); - @ldap_set_option($cid, LDAP_OPT_PROTOCOL_VERSION, 3); - $ds = @ldap_bind($cid, $this->admin, $this->password); + @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3); + $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password); - if(!$ds){ + if(!$this->bind_id){ $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); if(!empty($this->admin)){ $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection); @@ -129,9 +139,24 @@ class setup_step_4 extends setup_step return("".$str.""); } } - } + + function resolve_user() + { + $filter = $this->resolve_filter; + $ldap = new LDAP("","",$this->connection); + $ldap->cd($this->base); + $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))"); + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[$attrs['dn']]=$attrs['dn']; + natcasesort($tmp); + } + return($tmp); + } + + function save_object() { foreach($this->attributes as $attr){ @@ -139,6 +164,22 @@ class setup_step_4 extends setup_step $this->$attr = $_POST[$attr]; } } + + if(isset($_POST['resolve_user'])){ + $this->resolve_user = !$this->resolve_user; + } + + if(isset($_POST['resolve_filter'])){ + $this->resolve_filter = $_POST['resolve_filter']; + } + + if(isset($_POST['use_selected_user'])){ + + if(isset($_POST['admin_to_use'])){ + $this->admin = $_POST['admin_to_use']; + $this->resolve_user = false; + } + } } } diff --git a/setup/setup_step4.tpl b/setup/setup_step4.tpl index 92fb445db..c19f32182 100644 --- a/setup/setup_step4.tpl +++ b/setup/setup_step4.tpl @@ -18,7 +18,7 @@
- +
@@ -51,12 +51,31 @@ {t}Admin DN{/t}
- + +
+
+ {if $resolve_user} +
+
+ +
+
+ +
+
+ +
+ +
+ {/if} +
{t}Admin password{/t} -- 2.30.2