diff --git a/lam/lib/account.inc b/lam/lib/account.inc index a26cbd07..cf308040 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -1604,6 +1604,8 @@ function creategroup($values) { // Will create the LDAP-Group $attr['sambaGroupType'] = '2'; if ($values->smb_displayName) $attr['displayName'] = utf8_encode($values->smb_displayName); } + foreach ($values->unix_memberUid as $user) + $attr['memberUid'][] = $user; $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr); if ($_SESSION['config']->scriptServer) setquotas($values,'group'); if ($success) { diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index ab199e4d..2ec53142 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -38,13 +38,12 @@ if (!isset($_POST['varkey'])) $varkey = session_id().time(); else $varkey = $_POST['varkey']; if (!isset($_SESSION['account_'.$varkey.'_account_new'])) $_SESSION['account_'.$varkey.'_account_new'] = new account(); -if (!isset($_SESSION['account_'.$varkey.'_account_old'])) $_SESSION['account_'.$varkey.'_account_old'] = new account(); if (!isset($_SESSION['account_'.$varkey.'_final_changegids'])) $_SESSION['account_'.$varkey.'_final_changegids'] = ''; // Register Session-Variables with references so we don't net to change to complete code if names changes $account_new =& $_SESSION['account_'.$varkey.'_account_new']; $final_changegids =& $_SESSION['account_'.$varkey.'_final_changegids']; -if (isset($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; +if (is_object($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; $ldap_intern =& $_SESSION['ldap']; $config_intern =& $_SESSION['config']; @@ -55,21 +54,20 @@ $userDN_intern =& $_SESSION['userDN']; if (isset($_POST['select'])) $select =& $_POST['select']; if (isset($_POST['load'])) $load =& $_POST['load']; -if (isset($_GET['DN'])) { - if (isset($_GET['DN']) && $_GET['DN']!='') { - if (isset($_SESSION['account_'.$varkey.'_account_old'])) { - unset($account_old); - unset($_SESSION['account_'.$varkey.'_account_old']); - $_SESSION['account_'.$varkey.'_account_old'] = new account(); - $account_old =& $_SESSION['account_'.$varkey.'_account_old']; - } - $DN = str_replace("\'", '',$_GET['DN']); - $account_new = loadgroup($DN); - $account_old = $account_new; - $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); - $final_changegids = ''; +if (isset($_GET['DN']) && $_GET['DN']!='') { + if (isset($_SESSION['account_'.$varkey.'_account_old'])) { + unset($account_old); + unset($_SESSION['account_'.$varkey.'_account_old']); } + $_SESSION['account_'.$varkey.'_account_old'] = new account(); + $account_old =& $_SESSION['account_'.$varkey.'_account_old']; + $DN = str_replace("\'", '',$_GET['DN']); + $account_new = loadgroup($DN); + $account_old = $account_new; + $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); + $final_changegids = ''; } + else if (count($_POST)==0) { // Startcondition. groupedit.php was called from outside $account_new = loadGroupProfile('default'); $account_new ->type = 'group'; diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/hostedit.php index 776f4ff9..be658c56 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/hostedit.php @@ -36,13 +36,11 @@ setlanguage(); if (!isset($_POST['varkey'])) $varkey = session_id().time(); else $varkey = $_POST['varkey']; - if (!isset($_SESSION['account_'.$varkey.'_account_new'])) $_SESSION['account_'.$varkey.'_account_new'] = new account(); -if (!isset($_SESSION['account_'.$varkey.'_account_old'])) $_SESSION['account_'.$varkey.'_account_old'] = new account(); // Register Session-Variables with references so we don't net to change to complete code if names changes $account_new =& $_SESSION['account_'.$varkey.'_account_new']; -if (isset($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; +if (is_object($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; $ldap_intern =& $_SESSION['ldap']; $config_intern =& $_SESSION['config']; @@ -51,23 +49,21 @@ $header_intern =& $_SESSION['header']; -if (isset($_GET['DN'])) { - if (isset($_GET['DN']) && $_GET['DN']!='') { - if (isset($_SESSION['account_'.$varkey.'_account_old'])) { - unset($account_old); - unset($_SESSION['account_'.$varkey.'_account_old']); - $_SESSION['account_'.$varkey.'_account_old'] = new account(); - $account_old =& $_SESSION['account_'.$varkey.'_account_old']; - } - $DN = str_replace("\'", '',$_GET['DN']); - $account_new = loadhost($DN); - $account_new->smb_flagsW = 1; - $account_new->smb_flagsX = 1; - $account_old = $account_new; - // Store only DN without uid=$name - $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); - $_SESSION['final_changegids'] = ''; +if (isset($_GET['DN']) && $_GET['DN']!='') { + if (isset($_SESSION['account_'.$varkey.'_account_old'])) { + unset($account_old); + unset($_SESSION['account_'.$varkey.'_account_old']); } + $_SESSION['account_'.$varkey.'_account_old'] = new account(); + $account_old =& $_SESSION['account_'.$varkey.'_account_old']; + $DN = str_replace("\'", '',$_GET['DN']); + $account_new = loadhost($DN); + $account_new->smb_flagsW = 1; + $account_new->smb_flagsX = 1; + $account_old = $account_new; + // Store only DN without uid=$name + $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); + $_SESSION['final_changegids'] = ''; } else if (count($_POST)==0) { // Startcondition. hostedit.php was called from outside $account_new = loadHostProfile('default'); diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index b91b516c..d8fc5bb2 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -38,7 +38,6 @@ if (!isset($_POST['varkey'])) $varkey = session_id().time(); else $varkey = $_POST['varkey']; if (!isset($_SESSION['account_'.$varkey.'_account_new'])) $_SESSION['account_'.$varkey.'_account_new'] = new account(); -if (!isset($_SESSION['account_'.$varkey.'_account_old'])) $_SESSION['account_'.$varkey.'_account_old'] = new account(); if (!isset($_SESSION['account_'.$varkey.'_final_changegids'])) $_SESSION['account_'.$varkey.'_final_changegids'] = ''; if (!isset($_SESSION['account_'.$varkey.'_shelllist'])) $_SESSION['account_'.$varkey.'_shelllist'] = getshells(); @@ -46,7 +45,7 @@ if (!isset($_SESSION['account_'.$varkey.'_shelllist'])) $_SESSION['account_'.$va $account_new =& $_SESSION['account_'.$varkey.'_account_new']; $shelllist =& $_SESSION['account_'.$varkey.'_shelllist']; $final_changegids =& $_SESSION['account_'.$varkey.'_final_changegids']; -if (isset($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; +if (is_object($_SESSION['account_'.$varkey.'_account_old'])) $account_old =& $_SESSION['account_'.$varkey.'_account_old']; $ldap_intern =& $_SESSION['ldap']; $config_intern =& $_SESSION['config']; @@ -56,24 +55,22 @@ $hostDN_intern =& $_SESSION['hostDN']; -if (isset($_GET['DN'])) { - if (isset($_GET['DN']) && $_GET['DN']!='') { - if (isset($_SESSION['account_'.$varkey.'_account_old'])) { - unset($account_old); - unset($_SESSION['account_'.$varkey.'_account_old']); - $_SESSION['account_'.$varkey.'_account_old'] = new account(); - $account_old =& $_SESSION['account_'.$varkey.'_account_old']; - } - $DN = str_replace("\'", '',$_GET['DN']); - $account_new = loaduser($DN); - $account_new ->type = 'user'; - $account_old = $account_new; - $account_new->unix_password=''; - $account_new->smb_password=''; - $account_new->smb_flagsW = 0; - $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); - $final_changegids = ''; +if (isset($_GET['DN']) && $_GET['DN']!='') { + if (isset($_SESSION['account_'.$varkey.'_account_old'])) { + unset($account_old); + unset($_SESSION['account_'.$varkey.'_account_old']); } + $_SESSION['account_'.$varkey.'_account_old'] = new account(); + $account_old =& $_SESSION['account_'.$varkey.'_account_old']; + $DN = str_replace("\'", '',$_GET['DN']); + $account_new = loaduser($DN); + $account_new ->type = 'user'; + $account_old = $account_new; + $account_new->unix_password=''; + $account_new->smb_password=''; + $account_new->smb_flagsW = 0; + $account_new->general_dn = substr($account_new->general_dn, strpos($account_new->general_dn, ',')+1); + $final_changegids = ''; } else if (count($_POST)==0) { // Startcondition. useredit.php was called from outside