From c1cabd209712a62da426a04f8402b5c4bb60beba Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 4 Jul 2008 07:48:31 +0000 Subject: [PATCH] Updated admin account creation in setup-migration. -Check if the specified user id is already used. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11532 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/setup/class_setupStep_Migrate.inc | 31 +++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc index 37dc7bef8..9f20ab6a2 100644 --- a/gosa-core/setup/class_setupStep_Migrate.inc +++ b/gosa-core/setup/class_setupStep_Migrate.inc @@ -1019,6 +1019,16 @@ class Step_Migrate extends setup_step { $pw1 = $pw2 = ""; $uid = ""; + + /* On first call check for rid/sid base */ + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap = new ldapMultiplexer($ldap_l); if(isset($_POST['new_user_uid'])){ $uid = $_POST['new_user_uid']; @@ -1030,6 +1040,14 @@ class Step_Migrate extends setup_step $pw2 = $_POST['new_user_password2']; } + + $ldap->cd($cv['base']); + $ldap->search("(uid=".$uid.")"); + if($ldap->count()){ + msg_dialog::display(_("Input error"),msgPool::duplicated(_("Uid")), ERROR_DIALOG); + return false; + } + if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){ msg_dialog::display(_("Password error"), _("Provided passwords do not match!"), ERROR_DIALOG); return false; @@ -1039,17 +1057,8 @@ class Step_Migrate extends setup_step msg_dialog::display(_("Input error"), _("Specify a valid user ID!"), ERROR_DIALOG); return false; } - - /* On first call check for rid/sid base */ - $cv = $this->parent->captured_values; - $ldap_l = new LDAP($cv['admin'], - $cv['password'], - $cv['connection'], - FALSE, - $cv['tls']); - - $ldap = new ldapMultiplexer($ldap_l); - + + /* Get current base attributes */ $ldap->cd($cv['base']); -- 2.30.2