summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de6d4db)
raw | patch | inline | side by side (parent: de6d4db)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 May 2007 10:37:29 +0000 (10:37 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 10 May 2007 10:37:29 +0000 (10:37 +0000) |
Added uid to create user input fields
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6344 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6344 594d385d-05f5-0310-b6e9-bd551577e9d8
setup/class_setupStep_Migrate.inc | patch | blob | history | |
setup/setup_migrate.tpl | patch | blob | history |
index 2e8a9d2dfb729fbb0972896c51b989af2b86186c..cf487a90b68a27b72deb35156048fa9665065258 100644 (file)
/* Create Acl attributes */
var $acl_create_dialog = FALSE;
- var $acl_create_type = "group";
var $acl_create_selected= ""; // Currently selected element, that should receive admin rights
var $acl_create_changes = ""; // Contains ldif information about changes
var $acl_create_confirmed= FALSE;
function create_admin_user()
{
$pw1 = $pw2 = "";
+ $uid = "";
+ if(isset($_POST['new_user_uid'])){
+ $uid = $_POST['new_user_uid'];
+ }
+
if(isset($_POST['new_user_password'])){
$pw1 = $_POST['new_user_password'];
}
print_red(_("Specified passwords are empty or not equal."));
return false;
}
-
+
+ if(!is_uid($uid) || empty($uid)){
+ print_red(_("Please specify a valid uid."));
+ return false;
+ }
+
/* Establish ldap connection */
$cv = $this->parent->captured_values;
$ldap = new LDAP($cv['admin'],
if($cv['peopledn'] == "cn"){
$dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base'];
}else{
- $dn = "uid=admin,".$cv['peopleou'].",".$cv['base'];
+ $dn = "uid=".$uid.",".$cv['peopleou'].",".$cv['base'];
}
$methods = @passwordMethod::get_available_methods_if_not_loaded();
$new_user['givenName'] = "System";
$new_user['sn'] = "Administrator";
$new_user['cn'] = "System Administrator";
- $new_user['uid'] = "admin";
+ $new_user['uid'] = $uid;
$new_user['userPassword'] = $hash;
$ldap->cd($cv['base']);
+
+ $ldap->cat($dn,array("dn"));
+ if($ldap->count()){
+ print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),
+ $dn));
+ return(FALSE);
+ }
+
$ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
$ldap->cd($dn);
$res = $ldap->add($new_user);
$this->show_details = FALSE;
}
- if(isset($_POST['create_acls_create_confirmed'])){
- if($this->create_admin()){
- $this->acl_create_dialog = FALSE;
- $this->dialog = FALSE;
- $this->show_details = FALSE;
- $this->initialize_checks();
- }
- }
+# if(isset($_POST['create_acls_create_confirmed'])){
+# if($this->create_admin()){
+# $this->acl_create_dialog = FALSE;
+# $this->dialog = FALSE;
+# $this->show_details = FALSE;
+# $this->initialize_checks();
+# }
+# }
if(isset($_POST['create_acls_create'])){
$this->create_admin(TRUE);
if($this->acl_create_dialog){
$smarty = get_smarty();
+
+ $uid = "admin";
+ if(isset($_POST['new_user_uid'])){
+ $uid = $_POST['new_user_uid'];
+ }
+
+ $smarty->assign("new_user_uid",$uid);
$smarty->assign("new_user_password",@$_POST['new_user_password']);
$smarty->assign("new_user_password2",@$_POST['new_user_password2']);
- $smarty->assign("users" ,$this->get_user_list());
- $smarty->assign("users_cnt" ,count($this->get_user_list()));
-// $smarty->assign("groups",$this->get_group_list());
-// $smarty->assign("groups_cnt",count($this->get_group_list()));
- $smarty->assign("type" ,$this->acl_create_type);
$smarty->assign("method","create_acls");
$smarty->assign("acl_create_selected",$this->acl_create_selected);
$smarty->assign("what_will_be_done_now",$this->acl_create_changes);
/* Get "create acl" dialog posts */
if($this->acl_create_dialog){
- if(isset($_POST['create_acls_create'])){
- if(isset($_POST['create_acls_selected'])){
- $this->acl_create_selected = base64_decode($_POST['create_acls_selected']);
- }else{
- $this->acl_create_selected = "";
- }
- }
if(isset($_POST['create_acls_create_abort'])){
$this->acl_create_selected = "";
}
-
- if(isset($_POST['acl_create_type'])){
- $this->acl_create_type = $_POST['acl_create_type'];
- }
}
/* Get selected departments */
index b2f6413055f4a9eb46c9a2441bdf6277650dfba9..a20675eb99a5d6e2135b2c5d6f33acf9663dc8ba 100644 (file)
--- a/setup/setup_migrate.tpl
+++ b/setup/setup_migrate.tpl
<i>System administrator</i>
</td>
</tr>
- <tr>
- <td>
- {t}User ID{/t}:
- </td>
- <td>
- <i>admin</i>
- </td>
- </tr>
+ <tr>
+ <td>
+ {t}User ID{/t}:
+ </td>
+ <td>
+ <input type='text' value='{$new_user_uid}' name='new_user_uid'><br>
+ </td>
+ </tr>
<tr>
<td>
{t}Password{/t}:
document.mainform.new_user_password.focus();
-->
</script>
- <input type='submit' name='create_admin_user' value='{t}Apply{/t}'>
-
- {if $users_cnt != 0 }
-
- <h2>{t}Assign super administrator permissions to an existing user{/t}</h2>
- <p>{t}To grant administrative permissions to a user, select one and choose 'Assign'.{/t}</p>
- <select name='create_acls_selected' size="12" style='width:100%;'>
- {html_options options=$users selected=$acl_create_selected}
- </select>
- <input type='submit' name='create_acls_create' value='{t}Apply{/t}'>
- {/if}
<p class='seperator'> </p>
-
<div style='width:99%; text-align:right; padding:5px;'>
+ <input type='submit' name='create_admin_user' value='{t}Apply{/t}'>
<input type='submit' name='create_acls_cancel' value='{t}Cancel{/t}'>
</div>