From fd6f511e7a90ef126acc209608e4c4820de5da7d Mon Sep 17 00:00:00 2001 From: katagia Date: Fri, 12 Sep 2003 07:16:23 +0000 Subject: [PATCH] fixed smaller bugs realted to new design f groupedit.php --- lam/lib/account.inc | 11 ++++++++--- lam/templates/account/groupedit.php | 27 +++++++++++++++++++-------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 49d3d3b2..4b3ded4f 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -181,6 +181,7 @@ function array_delete($values, $array) { // This function will return all values function checkglobal($values, $type, $values_old=false) { // This functions checks all global account parameters $values is class account(), $type=user|host|group // If all values are OK an array of class account is returned. Else an error-string is returned $return = new account(); + $return->general_dn = $values->general_dn; switch ($type) { case 'user' : // Check if Homedir is valid @@ -662,12 +663,13 @@ function ldapexists($values, $type, $values_old=false) { // This function will s $keys = array_keys($_SESSION['groupDN']); unset ($keys[0]); $keys = array_values($keys); - if ( ($values_old->general_username != $values->general_username) && + if (in_array($search , $keys)) print "hit"; + if ( ($values_old->general_username != $values->general_username) && ($_SESSION['groupDN'][0] != $values->general_username) && (in_array($search , $keys)) ) return sprintf (_('%s already exists!'), $type); if ((!$values_old) && ($_SESSION['groupDN'][0] != $values->general_username) && - (in_array($search , $keys))) return sprintf (_('%s already exists!'), $type); + (in_array($search , $keys)) ) return sprintf (_('%s already exists!'), $type); break; case 'host': ldapreload('host'); @@ -715,6 +717,7 @@ function getgid($groupname) { // Will return the the gid to an existing Groupnam function checkid($values, $type, $values_old=false) { // if value is empty will return an unused id from all ids found in LDAP else check existing value switch ($type) { case 'user': + ldapreload('user'); $minID = intval($_SESSION['config']->get_minUID()); $maxID = intval($_SESSION['config']->get_maxUID()); $suffix = $_SESSION['config']->get_UserSuffix(); @@ -725,6 +728,7 @@ function checkid($values, $type, $values_old=false) { // if value is empty will // $ids[] = $_SESSION['userDN'][$key]['uidNumber']; break; case 'group': + ldapreload('group'); $minID = intval($_SESSION['config']->get_MinGID()); $maxID = intval($_SESSION['config']->get_MaxGID()); $suffix = $_SESSION['config']->get_GroupSuffix(); @@ -735,6 +739,7 @@ function checkid($values, $type, $values_old=false) { // if value is empty will // $ids[] = $_SESSION['groupDN'][$key]['gidNumber']; break; case 'host': + ldapreload('host'); $minID = intval($_SESSION['config']->get_MinMachine()); $maxID = intval($_SESSION['config']->get_MaxMachine()); $suffix = $_SESSION['config']->get_HostSuffix(); @@ -746,7 +751,7 @@ function checkid($values, $type, $values_old=false) { // if value is empty will break; } if ($values->general_uidNumber=='') { - if (!isset($values_old)) { + if (!isset($values_old->general_uidNumber)) { if ($keys) { $id = 0; foreach ($keys as $key) diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index 3f96fa6b..36ea9cb9 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -42,8 +42,11 @@ if (isset($_GET['DN'])) { $_SESSION['account']->general_dn = substr($_SESSION['account']->general_dn, strpos($_SESSION['account']->general_dn, ',')+1); $_SESSION['final_changegids'] = ''; } - else $_SESSION['account'] = loadGroupProfile('default'); - + else { + $_SESSION['account'] = loadGroupProfile('default'); + if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']); + } + $_SESSION['account'] ->type = 'group'; $values = getquotas($type); if (is_object($values)) { while (list($key, $val) = each($values)) // Set only defined values @@ -91,10 +94,9 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch $_SESSION['account']->general_username = $_POST['f_general_username']; $_SESSION['account']->general_uidNumber = $_POST['f_general_uidNumber']; $_SESSION['account']->general_gecos = $_POST['f_general_gecos']; - // Check if values are OK and set automatic values. if not error-variable will be set - if (isset($_SESSION['account_old'])) list($values, $errors) = checkglobal($_SESSION['account'], $_SESSION['account']->type, $_SESSION['account_old']); // account.inc - else list($values, $errors) = checkglobal($_SESSION['account'], $_SESSION['account']->type); // account.inc + if (isset($_SESSION['account_old'])) list($values, $errors) = checkglobal($_SESSION['account'], 'group', $_SESSION['account_old']); // account.inc + else list($values, $errors) = checkglobal($_SESSION['account'], 'group'); // account.inc if (is_object($values)) { // Set only defined values while (list($key, $val) = each($values)) if (isset($val)) $_SESSION['account']->$key = $val; @@ -227,6 +229,7 @@ do { // X-Or, only one if() can be true echo "\n"; echo "
\n"; + if (is_array($errors)) { echo "\n"; for ($i=0; $i\n
"; echo "
". _('Additional group members') . "\n"; echo "\n"; - echo "\n"; - echo "
"; + echo "
"; echo _('Group members'); echo "\">

"; echo ""._('Help-XX')."
"; + echo "
"; echo _('Available users'); echo "\n"; echo "\n'."\n"; } + $disabled = ""; + if (!isset($_SESSION['account']->smb_mapgroup)) { // Samba page nit viewd; can not create group because if missing options + $disabled = "disabled"; + echo ""; + StatusMessage("ERROR", _("Samba Options not set!"), _("Please check settings on samba page.")); + echo ""; + } if (isset($_SESSION['account_old']->general_objectClass)) { if (($_SESSION['config']->samba3 == 'yes') && (!in_array('sambaGroupMapping', $_SESSION['account_old']->general_objectClass))) { echo ''; @@ -501,7 +512,7 @@ switch ($select_local) { // Select which part of page will be loaded echo _('Save profile'); echo '">'._('Help').''. ''."\n".'
"; echo "
"; echo _('Please select page:'); @@ -481,6 +485,13 @@ switch ($select_local) { // Select which part of page will be loaded echo _('Change GID-Number of all users in group to new value'); echo '
'. - ''.