2001-09-02 01:32:40 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-01-27 00:26:19 +01:00
|
|
|
* eGroupWare - account administration *
|
|
|
|
* http://www.egroupware.org *
|
2003-08-28 16:16:30 +02:00
|
|
|
* -------------------------------------------- *
|
2001-09-02 01:32:40 +02:00
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2001-09-04 05:29:36 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
2001-09-02 01:32:40 +02:00
|
|
|
class boaccounts
|
|
|
|
{
|
2001-09-04 06:26:51 +02:00
|
|
|
var $so;
|
2003-08-28 16:16:30 +02:00
|
|
|
var $public_functions = array(
|
|
|
|
'add_group' => True,
|
|
|
|
'add_user' => True,
|
|
|
|
'delete_group' => True,
|
|
|
|
'delete_user' => True,
|
|
|
|
'edit_group' => True,
|
|
|
|
'edit_user' => True,
|
2002-01-10 19:18:44 +01:00
|
|
|
'set_group_managers' => True
|
2001-09-02 01:32:40 +02:00
|
|
|
);
|
|
|
|
|
2001-10-10 17:10:15 +02:00
|
|
|
var $xml_functions = array();
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
var $soap_functions = array(
|
|
|
|
'add_user' => array(
|
|
|
|
'in' => array('int', 'struct'),
|
|
|
|
'out' => array()
|
2001-10-10 17:10:15 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
function boaccounts()
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$this->so =& CreateObject('admin.soaccounts');
|
2006-03-08 17:53:16 +01:00
|
|
|
|
|
|
|
if (get_magic_quotes_gpc()) // deal with magic_quotes_gpc On
|
|
|
|
{
|
|
|
|
$_POST = $this->array_stripslashes($_POST);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* applies stripslashes recursivly on each element of an array
|
|
|
|
*
|
|
|
|
* @param array &$var
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function array_stripslashes($var)
|
|
|
|
{
|
|
|
|
if (!is_array($var))
|
|
|
|
{
|
|
|
|
return stripslashes($var);
|
|
|
|
}
|
|
|
|
foreach($var as $key => $val)
|
|
|
|
{
|
|
|
|
$var[$key] = is_array($val) ? $this->array_stripslashes($val) : stripslashes($val);
|
|
|
|
}
|
|
|
|
return $var;
|
2001-10-10 17:10:15 +02:00
|
|
|
}
|
2001-09-04 06:26:51 +02:00
|
|
|
|
2001-12-18 07:10:32 +01:00
|
|
|
function DONTlist_methods($_type='xmlrpc')
|
2001-10-10 17:10:15 +02:00
|
|
|
{
|
|
|
|
/*
|
2005-10-14 19:03:16 +02:00
|
|
|
This handles introspection or discovery by the logged in client,
|
|
|
|
in which case the input might be an array. The server always calls
|
|
|
|
this function to fill the server dispatch map using a string.
|
2001-10-10 17:10:15 +02:00
|
|
|
*/
|
|
|
|
if (is_array($_type))
|
|
|
|
{
|
|
|
|
$_type = $_type['type'] ? $_type['type'] : $_type[0];
|
|
|
|
}
|
|
|
|
switch($_type)
|
|
|
|
{
|
|
|
|
case 'xmlrpc':
|
|
|
|
$xml_functions = array(
|
|
|
|
'rpc_add_user' => array(
|
|
|
|
'function' => 'rpc_add_user',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Add a new account.')
|
|
|
|
),
|
|
|
|
'list_methods' => array(
|
|
|
|
'function' => 'list_methods',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcString)),
|
|
|
|
'docstring' => lang('Read this list of methods.')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
return $xml_functions;
|
|
|
|
break;
|
|
|
|
case 'soap':
|
|
|
|
return $this->soap_functions;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return array();
|
|
|
|
break;
|
2001-09-04 06:26:51 +02:00
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function delete_group()
|
2003-04-23 23:52:22 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if (!@isset($_POST['account_id']) || !@$_POST['account_id'] || $GLOBALS['egw']->acl->check('group_access',32,'admin'))
|
2003-04-23 23:52:22 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_groups');
|
|
|
|
return False;
|
2003-04-23 23:52:22 +02:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2003-12-20 19:51:51 +01:00
|
|
|
$account_id = (int)$_POST['account_id'];
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2006-06-07 01:42:56 +02:00
|
|
|
// delete all acl (and memberships) of group
|
|
|
|
$GLOBALS['egw']->acl->delete_account($account_id);
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
if (! @rmdir($GLOBALS['egw_info']['server']['files_dir'].SEP.'groups'.SEP.$GLOBALS['egw']->accounts->id2name($account_id)))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
$cd = 38;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cd = 32;
|
|
|
|
}
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->accounts->delete($account_id);
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
Header('Location: '.$GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
|
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2003-04-23 23:52:22 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function delete_user()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if (isset($_POST['cancel']) || $GLOBALS['egw']->acl->check('account_access',32,'admin'))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
elseif($_POST['delete_account'])
|
|
|
|
{
|
|
|
|
$accountid = $_POST['account_id'];
|
|
|
|
settype($account_id,'integer');
|
|
|
|
$account_id = get_account_id($accountid);
|
|
|
|
// make this information also in hook available
|
2005-10-14 19:03:16 +02:00
|
|
|
$lid = $GLOBALS['egw']->accounts->id2name($account_id);
|
2003-09-20 06:48:34 +02:00
|
|
|
|
2006-04-23 16:40:31 +02:00
|
|
|
$GLOBALS['hook_values'] = array(
|
|
|
|
'account_id' => $account_id,
|
|
|
|
'account_lid' => $lid,
|
|
|
|
'new_owner' => (int)$_POST['new_owner'],
|
|
|
|
'location' => 'deleteaccount',
|
|
|
|
);
|
2006-09-19 08:58:25 +02:00
|
|
|
// first all other apps, then preferences and admin
|
|
|
|
foreach(array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']),array('preferences','admin')),array('preferences','admin')) as $app)
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
2006-09-19 08:58:25 +02:00
|
|
|
$GLOBALS['egw']->hooks->single($GLOBALS['hook_values'],$app);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$basedir = $GLOBALS['egw_info']['server']['files_dir'] . SEP . 'users' . SEP;
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
if (! @rmdir($basedir . $lid))
|
|
|
|
{
|
|
|
|
$cd = 34;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cd = 29;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function add_group()
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->acl->check('group_access',4,'admin'))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
ExecMethod('admin.uiaccounts.list_groups');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
$group_permissions = ($_POST['account_apps']?$_POST['account_apps']:Array());
|
2001-09-03 04:58:25 +02:00
|
|
|
$account_apps = Array();
|
|
|
|
@reset($group_permissions);
|
|
|
|
while(list($key,$value) = each($group_permissions))
|
|
|
|
{
|
|
|
|
if($value)
|
|
|
|
{
|
|
|
|
$account_apps[$key] = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@reset($account_apps);
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
$group_info = Array(
|
2003-12-20 19:51:51 +01:00
|
|
|
'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0),
|
2003-08-28 16:16:30 +02:00
|
|
|
'account_name' => ($_POST['account_name']?$_POST['account_name']:''),
|
2006-06-07 01:42:56 +02:00
|
|
|
'account_user' => $_POST['account_user'],
|
2001-12-18 07:10:32 +01:00
|
|
|
'account_apps' => $account_apps
|
2001-09-03 04:58:25 +02:00
|
|
|
);
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
$this->validate_group($group_info);
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
|
2001-09-04 05:13:28 +02:00
|
|
|
$group->acct_type = 'g';
|
2003-08-28 16:16:30 +02:00
|
|
|
$account_info = array(
|
2001-09-03 04:58:25 +02:00
|
|
|
'account_type' => 'g',
|
|
|
|
'account_lid' => $group_info['account_name'],
|
|
|
|
'account_passwd' => '',
|
|
|
|
'account_firstname' => $group_info['account_name'],
|
|
|
|
'account_lastname' => 'Group',
|
|
|
|
'account_status' => 'A',
|
2006-10-11 23:58:58 +02:00
|
|
|
'account_expires' => -1,
|
2001-09-03 04:58:25 +02:00
|
|
|
// 'account_file_space' => $account_file_space_number . "-" . $account_file_space_type,
|
2006-10-11 23:58:58 +02:00
|
|
|
'account_email' => $_POST['account_email'],
|
2001-09-03 04:58:25 +02:00
|
|
|
);
|
2004-07-13 00:06:13 +02:00
|
|
|
$group_info['account_id'] = $group->create($account_info);
|
|
|
|
// do the following only if we got an id - the create succided
|
|
|
|
if ($group_info['account_id'])
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2006-06-07 01:42:56 +02:00
|
|
|
$group->set_members($group_info['account_user'],$group_info['account_id']);
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$apps =& CreateObject('phpgwapi.applications',$group_info['account_id']);
|
2004-07-13 00:06:13 +02:00
|
|
|
$apps->update_data(Array());
|
|
|
|
reset($group_info['account_apps']);
|
|
|
|
while(list($app,$value) = each($group_info['account_apps']))
|
2001-09-04 05:13:28 +02:00
|
|
|
{
|
2004-07-13 00:06:13 +02:00
|
|
|
$apps->add($app);
|
|
|
|
$new_apps[] = $app;
|
2001-09-04 05:13:28 +02:00
|
|
|
}
|
2004-07-13 00:06:13 +02:00
|
|
|
$apps->save_repository();
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$basedir = $GLOBALS['egw_info']['server']['files_dir'] . SEP . 'groups' . SEP;
|
2004-07-13 00:06:13 +02:00
|
|
|
$cd = 31;
|
|
|
|
umask(000);
|
|
|
|
if (! @mkdir ($basedir . $group_info['account_name'], 0707))
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2004-07-13 00:06:13 +02:00
|
|
|
$cd = 37;
|
2001-09-03 04:58:25 +02:00
|
|
|
}
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_groups');
|
2004-07-13 00:06:13 +02:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
return False;
|
2001-09-03 04:58:25 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function add_user()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->acl->check('account_access',4,'admin'))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
2004-01-12 07:22:20 +01:00
|
|
|
|
|
|
|
$accountPrefix = '';
|
2005-10-14 19:03:16 +02:00
|
|
|
if(isset($GLOBALS['egw_info']['server']['account_prefix']))
|
2004-01-12 07:22:20 +01:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$accountPrefix = $GLOBALS['egw_info']['server']['account_prefix'];
|
2004-01-12 07:22:20 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
if ($_POST['submit'])
|
|
|
|
{
|
2006-04-16 14:31:00 +02:00
|
|
|
if (!($email = $_POST['account_email']))
|
|
|
|
{
|
|
|
|
$email = $GLOBALS['egw']->common->email_address($_POST['account_firstname'],$_POST['account_lastname'],$_POST['account_lid']);
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$userData = array(
|
|
|
|
'account_type' => 'u',
|
2004-01-12 07:22:20 +01:00
|
|
|
'account_lid' => $accountPrefix.$_POST['account_lid'],
|
2003-08-28 16:16:30 +02:00
|
|
|
'account_firstname' => $_POST['account_firstname'],
|
|
|
|
'account_lastname' => $_POST['account_lastname'],
|
|
|
|
'account_passwd' => $_POST['account_passwd'],
|
|
|
|
'status' => ($_POST['account_status'] ? 'A' : ''),
|
|
|
|
'account_status' => ($_POST['account_status'] ? 'A' : ''),
|
|
|
|
'old_loginid' => ($_GET['old_loginid']?rawurldecode($_GET['old_loginid']):''),
|
|
|
|
'account_id' => ($_GET['account_id']?$_GET['account_id']:0),
|
2003-09-13 19:14:30 +02:00
|
|
|
'account_primary_group' => $_POST['account_primary_group'],
|
2003-08-28 16:16:30 +02:00
|
|
|
'account_passwd_2' => $_POST['account_passwd_2'],
|
|
|
|
'account_groups' => $_POST['account_groups'],
|
|
|
|
'anonymous' => $_POST['anonymous'],
|
|
|
|
'changepassword' => $_POST['changepassword'],
|
|
|
|
'account_permissions' => $_POST['account_permissions'],
|
|
|
|
'homedirectory' => $_POST['homedirectory'],
|
|
|
|
'loginshell' => $_POST['loginshell'],
|
2004-07-04 19:33:13 +02:00
|
|
|
'account_expires_never' => $_POST['never_expires'],
|
2006-04-16 14:31:00 +02:00
|
|
|
'account_email' => $email,
|
2003-08-28 16:16:30 +02:00
|
|
|
/* 'file_space' => $_POST['account_file_space_number'] . "-" . $_POST['account_file_space_type'] */
|
|
|
|
);
|
2003-09-19 22:43:04 +02:00
|
|
|
|
|
|
|
// add the primary group, to the users other groups, if not already added
|
|
|
|
if(is_array($userData['account_groups']))
|
|
|
|
{
|
|
|
|
if(!in_array($userData['account_primary_group'],$userData['account_groups']))
|
|
|
|
{
|
2003-12-20 19:51:51 +01:00
|
|
|
$userData['account_groups'][] = (int)$userData['account_primary_group'];
|
2003-09-19 22:43:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2003-09-13 21:00:41 +02:00
|
|
|
{
|
2003-12-20 19:51:51 +01:00
|
|
|
$userData['account_groups'] = array((int)$userData['account_primary_group']);
|
2003-09-13 21:00:41 +02:00
|
|
|
}
|
2003-09-19 22:43:04 +02:00
|
|
|
|
|
|
|
// when does the account expire
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_POST['expires'] !== '' && !$_POST['never_expires'])
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$jscal =& CreateObject('phpgwapi.jscalendar',False);
|
2003-08-28 16:16:30 +02:00
|
|
|
$userData += $jscal->input2date($_POST['expires'],False,'account_expires_day','account_expires_month','account_expires_year');
|
|
|
|
}
|
2003-09-19 22:43:04 +02:00
|
|
|
|
|
|
|
// do we have all needed data??
|
2004-07-13 00:06:13 +02:00
|
|
|
if (!($errors = $this->validate_user($userData)) &&
|
|
|
|
($userData['account_id'] = $account_id = $this->so->add_user($userData))) // no error in the creation
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
if ($userData['anonymous'])
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->acl->add_repository('phpgwapi','anonymous',$account_id,1);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->acl->delete_repository('phpgwapi','anonymous',$account_id);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
|
|
|
// make this information for the hooks available
|
2004-07-12 21:53:07 +02:00
|
|
|
$GLOBALS['hook_values'] = $userData + array('new_passwd' => $userData['account_passwd']);
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
2003-09-13 21:00:41 +02:00
|
|
|
'location' => 'addaccount'
|
2003-10-07 19:06:53 +02:00
|
|
|
),False,True); // called for every app now, not only enabled ones
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$ui =& CreateObject('admin.uiaccounts');
|
2003-08-28 16:16:30 +02:00
|
|
|
$ui->create_edit_user($userData['account_id'],$userData,$errors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function edit_group()
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->acl->check('group_access',16,'admin'))
|
2001-09-04 06:26:51 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_groups');
|
|
|
|
return False;
|
2001-09-04 06:26:51 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
$group_permissions = ($_POST['account_apps']?$_POST['account_apps']:Array());
|
2001-09-03 04:58:25 +02:00
|
|
|
$account_apps = Array();
|
|
|
|
@reset($group_permissions);
|
|
|
|
while(list($key,$value) = each($group_permissions))
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
if($value)
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
$account_apps[$key] = True;
|
2001-09-02 09:30:25 +02:00
|
|
|
}
|
|
|
|
}
|
2001-09-03 04:58:25 +02:00
|
|
|
@reset($account_apps);
|
2001-09-02 09:30:25 +02:00
|
|
|
|
2001-09-03 04:58:25 +02:00
|
|
|
$group_info = Array(
|
2003-12-20 19:51:51 +01:00
|
|
|
'account_id' => ($_POST['account_id']?(int)$_POST['account_id']:0),
|
2003-08-28 16:16:30 +02:00
|
|
|
'account_name' => ($_POST['account_name']?$_POST['account_name']:''),
|
2006-06-07 01:42:56 +02:00
|
|
|
'account_user' => $_POST['account_user'],
|
2006-10-11 23:58:58 +02:00
|
|
|
'account_apps' => $account_apps,
|
2001-09-03 04:58:25 +02:00
|
|
|
);
|
2003-08-28 16:16:30 +02:00
|
|
|
$this->validate_group($group_info);
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
|
2001-09-03 04:58:25 +02:00
|
|
|
$old_group_info = $group->read_repository();
|
2001-12-18 07:10:32 +01:00
|
|
|
|
2001-09-02 09:30:25 +02:00
|
|
|
// Set group apps
|
2005-10-14 19:03:16 +02:00
|
|
|
$apps =& CreateObject('phpgwapi.applications',$group_info['account_id']);
|
2001-09-02 09:30:25 +02:00
|
|
|
$apps_before = $apps->read_account_specific();
|
|
|
|
$apps->update_data(Array());
|
|
|
|
$new_apps = Array();
|
2001-09-03 04:58:25 +02:00
|
|
|
if(count($group_info['account_apps']))
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
reset($group_info['account_apps']);
|
|
|
|
while(list($app,$value) = each($group_info['account_apps']))
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
$apps->add($app);
|
|
|
|
if(!@$apps_before[$app] || @$apps_before == False)
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
$new_apps[] = $app;
|
2001-09-02 09:30:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$apps->save_repository();
|
|
|
|
|
|
|
|
// Set new account_lid, if needed
|
2002-01-13 04:56:34 +01:00
|
|
|
if($group_info['account_name'] && $old_group_info['account_lid'] <> $group_info['account_name'])
|
2001-09-02 09:30:25 +02:00
|
|
|
{
|
2001-09-03 04:58:25 +02:00
|
|
|
$group->data['account_lid'] = $group_info['account_name'];
|
2004-03-30 06:23:23 +02:00
|
|
|
$group->data['firstname'] = $group_info['account_name'];
|
2001-12-18 07:10:32 +01:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$basedir = $GLOBALS['egw_info']['server']['files_dir'] . SEP . 'groups' . SEP;
|
2001-09-03 04:58:25 +02:00
|
|
|
if (! @rename($basedir . $old_group_info['account_lid'], $basedir . $group_info['account_name']))
|
|
|
|
{
|
|
|
|
$cd = 39;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cd = 33;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cd = 33;
|
2001-09-02 09:30:25 +02:00
|
|
|
}
|
|
|
|
|
2006-06-07 01:42:56 +02:00
|
|
|
$group->set_members($group_info['account_user'],$group_info['account_id']);
|
2001-09-02 09:30:25 +02:00
|
|
|
|
2004-06-23 15:19:38 +02:00
|
|
|
// This is down here so we are sure to catch the acl changes
|
|
|
|
// for LDAP to update the memberuid attribute
|
2006-10-11 23:58:58 +02:00
|
|
|
$group->data['account_email'] = $_POST['account_email'];
|
2001-09-02 09:30:25 +02:00
|
|
|
$group->save_repository();
|
2006-01-04 20:19:11 +01:00
|
|
|
|
|
|
|
$GLOBALS['hook_values'] = $group_info;
|
|
|
|
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
|
|
|
'location' => 'editgroup'
|
|
|
|
),False,True); // called for every app now, not only enabled ones)
|
2001-09-02 09:30:25 +02:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_groups');
|
|
|
|
return False;
|
2001-09-02 09:30:25 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function edit_user()
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->acl->check('account_access',16,'admin'))
|
2001-09-04 06:26:51 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
2004-01-12 07:22:20 +01:00
|
|
|
|
|
|
|
$accountPrefix = '';
|
2005-10-14 19:03:16 +02:00
|
|
|
if(isset($GLOBALS['egw_info']['server']['account_prefix']))
|
2004-01-12 07:22:20 +01:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$accountPrefix = $GLOBALS['egw_info']['server']['account_prefix'];
|
2004-01-12 07:22:20 +01:00
|
|
|
}
|
2001-09-04 06:26:51 +02:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_POST['submit'])
|
|
|
|
{
|
2006-04-16 14:31:00 +02:00
|
|
|
if (!($email = $_POST['account_email']))
|
|
|
|
{
|
|
|
|
$email = $GLOBALS['egw']->common->email_address($_POST['account_firstname'],$_POST['account_lastname'],$_POST['account_lid']);
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$userData = array(
|
2004-01-12 07:22:20 +01:00
|
|
|
'account_lid' => $accountPrefix.$_POST['account_lid'],
|
2006-06-09 02:05:14 +02:00
|
|
|
'account_firstname' => $_POST['account_firstname'],
|
|
|
|
'account_lastname' => $_POST['account_lastname'],
|
2003-08-28 16:16:30 +02:00
|
|
|
'account_passwd' => $_POST['account_passwd'],
|
|
|
|
'account_status' => ($_POST['account_status'] ? 'A' : ''),
|
|
|
|
'old_loginid' => ($_GET['old_loginid']?rawurldecode($_GET['old_loginid']):''),
|
|
|
|
'account_id' => ($_GET['account_id']?$_GET['account_id']:0),
|
|
|
|
'account_passwd_2' => $_POST['account_passwd_2'],
|
|
|
|
'account_groups' => $_POST['account_groups'],
|
2003-09-13 16:09:41 +02:00
|
|
|
'account_primary_group' => $_POST['account_primary_group'],
|
2003-08-28 16:16:30 +02:00
|
|
|
'anonymous' => $_POST['anonymous'],
|
|
|
|
'changepassword' => $_POST['changepassword'],
|
|
|
|
'account_permissions' => $_POST['account_permissions'],
|
|
|
|
'homedirectory' => $_POST['homedirectory'],
|
|
|
|
'loginshell' => $_POST['loginshell'],
|
2004-07-04 19:33:13 +02:00
|
|
|
'account_expires_never' => $_POST['never_expires'],
|
2006-06-09 02:05:14 +02:00
|
|
|
'account_email' => $email,
|
2003-08-28 16:16:30 +02:00
|
|
|
/* 'file_space' => $_POST['account_file_space_number'] . "-" . $_POST['account_file_space_type'] */
|
2001-09-02 01:32:40 +02:00
|
|
|
);
|
2003-11-07 00:08:10 +01:00
|
|
|
if ($userData['account_primary_group'] && (!isset($userData['account_groups']) || !in_array($userData['account_primary_group'],$userData['account_groups'])))
|
2003-09-13 21:00:41 +02:00
|
|
|
{
|
2003-12-20 19:51:51 +01:00
|
|
|
$userData['account_groups'][] = (int)$userData['account_primary_group'];
|
2003-09-13 21:00:41 +02:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_POST['expires'] !== '' && !$_POST['never_expires'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$jscal =& CreateObject('phpgwapi.jscalendar',False);
|
2003-08-28 16:16:30 +02:00
|
|
|
$userData += $jscal->input2date($_POST['expires'],False,'account_expires_day','account_expires_month','account_expires_year');
|
|
|
|
}
|
2005-07-22 11:22:04 +02:00
|
|
|
if (!($errors = $this->validate_user($userData)))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
$this->save_user($userData);
|
2004-07-04 19:33:13 +02:00
|
|
|
$GLOBALS['hook_values'] = $userData;
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
2003-09-13 21:00:41 +02:00
|
|
|
'location' => 'editaccount'
|
2003-10-07 19:06:53 +02:00
|
|
|
),False,True); // called for every app now, not only enabled ones)
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
// check if would create a menu
|
2001-09-02 01:32:40 +02:00
|
|
|
// if we do, we can't return to the users list, because
|
|
|
|
// there are also some other plugins
|
2001-12-27 16:14:02 +01:00
|
|
|
if (!ExecMethod('admin.uimenuclass.createHTMLCode','edit_user'))
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-07-22 11:22:04 +02:00
|
|
|
if ($userData['account_id'] == $GLOBALS['egw_info']['user']['account_id'])
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->redirect_link('/index.php',array( // without redirect changes happen only in the next page-view!
|
|
|
|
'menuaction' => 'admin.uiaccounts.list_users',
|
|
|
|
));
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.list_users');
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
else
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-07-22 11:22:04 +02:00
|
|
|
if ($userData['account_id'] == $GLOBALS['egw_info']['user']['account_id'])
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->redirect_link('/index.php',array( // without redirect changes happen only in the next page-view!
|
|
|
|
'menuaction' => 'admin.uiaccounts.edit_user',
|
|
|
|
'account_id' => $_GET['account_id'],
|
|
|
|
));
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
ExecMethod('admin.uiaccounts.edit_user',$_GET['account_id']);
|
|
|
|
return False;
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$ui =& CreateObject('admin.uiaccounts');
|
2003-08-28 16:16:30 +02:00
|
|
|
$ui->create_edit_user($userData['account_id'],$userData,$errors);
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-10 19:18:44 +01:00
|
|
|
function set_group_managers()
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if($GLOBALS['egw']->acl->check('group_access',16,'admin') || $_POST['cancel'])
|
2002-01-10 19:18:44 +01:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
|
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2002-01-10 19:18:44 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
elseif($_POST['submit'])
|
2002-01-10 19:18:44 +01:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$acl =& CreateObject('phpgwapi.acl',(int)$_POST['account_id']);
|
2002-01-10 19:18:44 +01:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$users = $GLOBALS['egw']->accounts->member($_POST['account_id']);
|
2002-01-10 19:18:44 +01:00
|
|
|
@reset($users);
|
|
|
|
while($managers && list($key,$user) = each($users))
|
|
|
|
{
|
2003-12-20 19:51:51 +01:00
|
|
|
$acl->add_repository('phpgw_group',(int)$_POST['account_id'],$user['account_id'],1);
|
2002-01-10 19:18:44 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$managers = $_POST['managers'];
|
2002-01-10 19:18:44 +01:00
|
|
|
@reset($managers);
|
|
|
|
while($managers && list($key,$manager) = each($managers))
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$acl->add_repository('phpgw_group',(int)$_POST['account_id'],$manager,(1 + EGW_ACL_GROUP_MANAGERS));
|
2002-01-10 19:18:44 +01:00
|
|
|
}
|
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
|
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2002-01-10 19:18:44 +01:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function validate_group($group_info)
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$errors = Array();
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
|
2001-09-03 04:58:25 +02:00
|
|
|
$group->read_repository();
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if(!$group_info['account_name'])
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$errors[] = lang('You must enter a group name.');
|
2003-04-23 03:08:32 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if($group_info['account_name'] != $group->id2name($group_info['account_id']))
|
2003-04-23 03:08:32 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($group->exists($group_info['account_name']))
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$errors[] = lang('Sorry, that group name has already been taken.');
|
2001-09-03 04:58:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (preg_match ("/\D/", $account_file_space_number))
|
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$errors[] = lang ('File space must be an integer');
|
2001-09-03 04:58:25 +02:00
|
|
|
}
|
|
|
|
*/
|
2003-08-28 16:16:30 +02:00
|
|
|
if(count($errors))
|
2001-09-03 04:58:25 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$ui =& CreateObject('admin.uiaccounts');
|
2003-08-28 16:16:30 +02:00
|
|
|
$ui->create_edit_group($group_info,$errors);
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2001-09-03 04:58:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-09-02 01:32:40 +02:00
|
|
|
/* checks if the userdata are valid
|
|
|
|
returns FALSE if the data are correct
|
|
|
|
otherwise the error array
|
|
|
|
*/
|
2003-08-28 16:16:30 +02:00
|
|
|
function validate_user(&$_userData)
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$totalerrors = 0;
|
2001-09-02 01:32:40 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw_info']['server']['account_repository'] == 'ldap' &&
|
2003-09-01 00:09:12 +02:00
|
|
|
(!$_userData['account_lastname'] && !$_userData['lastname']))
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang('You must enter a lastname');
|
|
|
|
$totalerrors++;
|
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if (!$_userData['account_lid'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$error[$totalerrors] = lang('You must enter a loginid');
|
|
|
|
$totalerrors++;
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
2003-09-13 19:14:30 +02:00
|
|
|
|
|
|
|
if(!in_array($_userData['account_primary_group'],$_userData['account_groups']))
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang('The groups must include the primary group');
|
|
|
|
$totalerrors++;
|
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['old_loginid'] != $_userData['account_lid'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->accounts->exists($_userData['account_lid']))
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
if ($GLOBALS['egw']->accounts->exists($_userData['account_lid']) && $GLOBALS['egw']->accounts->get_type($_userData['account_lid'])=='g')
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang('There already is a group with this name. Userid\'s can not have the same name as a groupid');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang('That loginid has already been taken');
|
|
|
|
}
|
|
|
|
$totalerrors++;
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['account_passwd'] || $_userData['account_passwd_2'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['account_passwd'] != $_userData['account_passwd_2'])
|
2002-05-26 10:50:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$error[$totalerrors] = lang('The two passwords are not the same');
|
|
|
|
$totalerrors++;
|
2002-05-26 10:50:40 +02:00
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if (!count($_userData['account_permissions']) && !count($_userData['account_groups']))
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$error[$totalerrors] = lang('You must add at least 1 permission or group to this account');
|
|
|
|
$totalerrors++;
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['account_expires_month'] || $_userData['account_expires_day'] || $_userData['account_expires_year'] || $_userData['account_expires_never'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
if($_userData['account_expires_never'])
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$_userData['expires'] = -1;
|
|
|
|
$_userData['account_expires'] = $_userData['expires'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (! checkdate($_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year']))
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang('You have entered an invalid expiration date');
|
|
|
|
$totalerrors++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$_userData['expires'] = mktime(2,0,0,$_userData['account_expires_month'],$_userData['account_expires_day'],$_userData['account_expires_year']);
|
|
|
|
$_userData['account_expires'] = $_userData['expires'];
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$_userData['expires'] = -1;
|
|
|
|
$_userData['account_expires'] = $_userData['expires'];
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
$check_account_file_space = explode ('-', $_userData['file_space']);
|
|
|
|
if (preg_match ("/\D/", $check_account_file_space[0]))
|
|
|
|
{
|
|
|
|
$error[$totalerrors] = lang ('File space must be an integer');
|
|
|
|
$totalerrors++;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($totalerrors == 0)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
|
|
|
return $error;
|
|
|
|
}
|
|
|
|
}
|
2001-12-18 07:10:32 +01:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
/* stores the userdata */
|
|
|
|
function save_user($_userData)
|
2001-09-02 01:32:40 +02:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$account =& CreateObject('phpgwapi.accounts',$_userData['account_id'],'u');
|
2003-08-28 16:16:30 +02:00
|
|
|
$account->update_data($_userData);
|
|
|
|
$account->save_repository();
|
2006-06-07 01:42:56 +02:00
|
|
|
|
|
|
|
$account->set_memberships($_userData['account_groups'],$_userData['account_id']);
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['account_passwd'])
|
2001-12-18 07:10:32 +01:00
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$auth =& CreateObject('phpgwapi.auth');
|
2003-08-28 16:16:30 +02:00
|
|
|
$auth->change_password($old_passwd, $_userData['account_passwd'], $_userData['account_id']);
|
|
|
|
$GLOBALS['hook_values']['account_id'] = $_userData['account_id'];
|
|
|
|
$GLOBALS['hook_values']['old_passwd'] = $old_passwd;
|
|
|
|
$GLOBALS['hook_values']['new_passwd'] = $_userData['account_passwd'];
|
2003-10-07 19:06:53 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
2003-09-13 21:00:41 +02:00
|
|
|
'location' => 'changepassword'
|
2003-10-07 19:06:53 +02:00
|
|
|
),False,True); // called for every app now, not only enabled ones)
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$apps =& CreateObject('phpgwapi.applications',(int)$_userData['account_id']);
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['account_permissions'])
|
2003-04-28 01:16:15 +02:00
|
|
|
{
|
2005-03-30 16:46:37 +02:00
|
|
|
foreach($_userData['account_permissions'] as $app => $enabled)
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
2005-03-30 16:46:37 +02:00
|
|
|
if($enabled)
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
2005-03-30 16:46:37 +02:00
|
|
|
$apps->add($app);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$apps->save_repository();
|
2001-09-02 01:32:40 +02:00
|
|
|
|
2005-10-14 19:03:16 +02:00
|
|
|
$acl =& CreateObject('phpgwapi.acl',$_userData['account_id']);
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_userData['anonymous'])
|
|
|
|
{
|
|
|
|
$acl->add_repository('phpgwapi','anonymous',$_userData['account_id'],1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$acl->delete_repository('phpgwapi','anonymous',$_userData['account_id']);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-23 03:28:47 +02:00
|
|
|
$GLOBALS['egw']->acl->delete_repository('preferences','nopasswordchange',$_userData['account_id']);
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
2005-10-14 19:03:16 +02:00
|
|
|
$GLOBALS['egw']->session->delete_cache((int)$_userData['account_id']);
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
2001-09-03 04:58:25 +02:00
|
|
|
|
2002-01-10 19:18:44 +01:00
|
|
|
function load_group_managers($account_id)
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$temp_user = $GLOBALS['egw']->acl->get_ids_for_location($account_id,EGW_ACL_GROUP_MANAGERS,'phpgw_group');
|
2002-01-10 19:18:44 +01:00
|
|
|
if(!$temp_user)
|
|
|
|
{
|
|
|
|
return Array();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$group_user = $temp_user;
|
|
|
|
}
|
|
|
|
$account_user = Array();
|
|
|
|
while (list($key,$user) = each($group_user))
|
|
|
|
{
|
|
|
|
$account_user[$user] = ' selected';
|
|
|
|
}
|
|
|
|
@reset($account_user);
|
|
|
|
return $account_user;
|
|
|
|
}
|
|
|
|
|
2001-09-03 04:58:25 +02:00
|
|
|
function load_group_apps($account_id)
|
|
|
|
{
|
2005-10-14 19:03:16 +02:00
|
|
|
$apps =& CreateObject('phpgwapi.applications',(int)$account_id);
|
2001-09-03 04:58:25 +02:00
|
|
|
$app_list = $apps->read_account_specific();
|
|
|
|
$account_apps = Array();
|
|
|
|
while(list($key,$app) = each($app_list))
|
|
|
|
{
|
|
|
|
$account_apps[$app['name']] = True;
|
|
|
|
}
|
|
|
|
@reset($account_apps);
|
|
|
|
return $account_apps;
|
|
|
|
}
|
2001-10-10 17:10:15 +02:00
|
|
|
|
|
|
|
// xmlrpc functions
|
|
|
|
|
|
|
|
function rpc_add_user($data)
|
|
|
|
{
|
2001-12-18 07:10:32 +01:00
|
|
|
exit;
|
|
|
|
|
2001-10-10 17:10:15 +02:00
|
|
|
if (!$errors = $this->validate_user($data))
|
|
|
|
{
|
|
|
|
$result = $this->so->add_user($data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$result = $errors;
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
2001-09-02 01:32:40 +02:00
|
|
|
}
|
|
|
|
?>
|