- fixed a view error in working together with setup

- quitent (hopefully) all debug messages
This commit is contained in:
Ralf Becker 2006-06-07 05:16:56 +00:00
parent 284369fa23
commit 3234d5723e
3 changed files with 15 additions and 7 deletions

View File

@ -300,7 +300,7 @@ class accounts extends accounts_backend
}
}
}
if (($id = parent::save($data)) && $data['account_primary_group'] &&
if (($id = parent::save($data)) && $data['account_type'] == 'u' && $data['account_primary_group'] &&
(!($memberships = $this->memberships($id,true)) || !in_array($data['account_primary_group'],$memberships)))
{
$memberships[] = $data['account_primary_group'];
@ -343,8 +343,7 @@ class accounts extends accounts_backend
if (is_null($data)) $data = $this->data; // depricated use
$expires = isset($data['account_expires']) ? $data['account_expires'] : $data['expires'];
echo "<p>is_expired(".print_r($data,true).") expires=$expires --> ".(int)($expires != -1 && $expires < time())."</p>\n";
echo function_backtrace();
return $expires != -1 && $expires < time();
}

View File

@ -136,7 +136,7 @@ class accounts_backend
*/
function save(&$data)
{
$is_group = $data['account_id'] < 0 || $data['type'] == 'g';
$is_group = $data['account_id'] < 0 || $data['account_type'] === 'g';
$data_utf8 = $this->translation->convert($data,$this->translation->charset(),'utf-8');
@ -211,12 +211,12 @@ class accounts_backend
$to_write = $this->_merge_user($to_write,$data_utf8,!$old);
$data['account_type'] = 'u';
}
echo "<p>ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")</p>\n";
//echo "<p>ldap_".($old ? 'modify' : 'add')."(,$dn,".print_r($to_write,true).")</p>\n";
// modifying or adding the entry
if ($old && !ldap_modify($this->ds,$dn,$to_write) ||
!$old && !ldap_add($this->ds,$dn,$to_write))
{
echo ldap_error($this->ds); exit;
//echo ldap_error($this->ds); exit;
return false;
}
if ($memberships) // setting the previous memberships of the renamed account

View File

@ -64,6 +64,11 @@ class accounts_backend
$this->db = clone($GLOBALS['egw']->db);
}
$this->db->set_app('phpgwapi'); // to load the right table-definitions for insert, select, update, ...
if (!is_object($GLOBALS['egw']->acl))
{
$GLOBALS['egw']->acl =& CreateObject('phpgwapi.acl');
}
}
/**
@ -100,7 +105,7 @@ class accounts_backend
*/
function save(&$data)
{
echo "<p>accounts_sql::save(".print_r($data,true).")</p>\n";
//echo "<p>accounts_sql::save(".print_r($data,true).")</p>\n";
$to_write = $data;
unset($to_write['account_id']);
unset($to_write['account_passwd']);
@ -108,6 +113,10 @@ class accounts_backend
// encrypt password if given or unset it if not
if ($data['account_passwd'])
{
if (!is_object($GLOBALS['egw']->auth))
{
$GLOBALS['egw']->auth =& CreateObject('phpgwapi.auth');
}
$to_write['account_pwd'] = $GLOBALS['egw']->auth->encrypt_sql($data['account_passwd']);
}
if (!(int)$data['account_id'])