2001-09-02 01:32:40 +02:00
|
|
|
<?php
|
2007-03-09 13:07:15 +01:00
|
|
|
/***************************************************************************\
|
|
|
|
* eGroupWare - account administration *
|
|
|
|
* http://www.egroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
2001-09-02 01:32:40 +02:00
|
|
|
|
2001-09-04 05:29:36 +02:00
|
|
|
/* $Id$ */
|
2001-12-21 04:41:06 +01:00
|
|
|
|
2001-09-02 01:32:40 +02:00
|
|
|
class soaccounts
|
|
|
|
{
|
|
|
|
function soaccounts()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-10-10 17:10:15 +02:00
|
|
|
function add_user($userData)
|
|
|
|
{
|
2007-03-09 13:07:15 +01:00
|
|
|
$userData['account_expires'] = $userData['expires'];
|
|
|
|
|
2005-01-28 23:01:12 +01:00
|
|
|
if($userData['email'] != "")
|
|
|
|
{
|
|
|
|
$userData['account_email'] = $userData['email'];
|
|
|
|
}
|
2010-09-27 09:52:41 +02:00
|
|
|
if ($userData['mustchangepassword'] == 1) $userData['account_lastpwd_change']=0;
|
2006-04-30 14:18:47 +02:00
|
|
|
if (!($userData['account_id'] = $GLOBALS['egw']->accounts->create($userData)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-06-07 01:42:56 +02:00
|
|
|
$GLOBALS['egw']->accounts->set_memberships($userData['account_groups'],$userData['account_id']);
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$apps =& CreateObject('phpgwapi.applications',$userData['account_id']);
|
2001-10-10 17:10:15 +02:00
|
|
|
$apps->read_installed_apps();
|
2007-03-09 13:07:15 +01:00
|
|
|
/* dont think this is still used -- RalfBecker 2006-06-03
|
|
|
|
// Read Group Apps
|
|
|
|
if ($userData['account_groups'])
|
|
|
|
{
|
|
|
|
$apps->account_type = 'g';
|
|
|
|
reset($userData['account_groups']);
|
|
|
|
while($groups = each($userData['account_groups']))
|
|
|
|
{
|
|
|
|
$apps->account_id = $groups[0];
|
|
|
|
$old_app_groups = $apps->read_account_specific();
|
|
|
|
@reset($old_app_groups);
|
|
|
|
while($old_group_app = each($old_app_groups))
|
|
|
|
{
|
|
|
|
if (!$apps_after[$old_group_app[0]])
|
|
|
|
{
|
|
|
|
$apps_after[$old_group_app[0]] = $old_app_groups[$old_group_app[0]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2001-10-10 17:10:15 +02:00
|
|
|
$apps->account_type = 'u';
|
|
|
|
$apps->account_id = $userData['account_id'];
|
2003-08-28 16:16:30 +02:00
|
|
|
$apps->data = Array(Array());
|
2001-10-10 17:10:15 +02:00
|
|
|
|
|
|
|
if ($userData['account_permissions'])
|
|
|
|
{
|
|
|
|
@reset($userData['account_permissions']);
|
|
|
|
while (list($app,$turned_on) = each($userData['account_permissions']))
|
|
|
|
{
|
|
|
|
if ($turned_on)
|
|
|
|
{
|
|
|
|
$apps->add($app);
|
2007-03-09 13:07:15 +01:00
|
|
|
/* dont think this is still used -- RalfBecker 2006-06-03
|
|
|
|
if (!$apps_after[$app])
|
|
|
|
{
|
|
|
|
$apps_after[] = $app;
|
|
|
|
}
|
|
|
|
*/
|
2001-10-10 17:10:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$apps->save_repository();
|
|
|
|
|
2006-06-23 03:28:47 +02:00
|
|
|
if (!$userData['changepassword'])
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
2006-06-23 03:28:47 +02:00
|
|
|
$GLOBALS['egw']->acl->add_repository('preferences','nopasswordchange',$userData['account_id'],1);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
2001-10-10 17:10:15 +02:00
|
|
|
|
|
|
|
$apps->account_apps = array(array());
|
2007-03-09 13:07:15 +01:00
|
|
|
// $apps_after = array(array());
|
2001-10-10 17:10:15 +02:00
|
|
|
|
|
|
|
return $userData['account_id'];
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
?>
|