Allow setting of group or apps, do not require both

This commit is contained in:
Miles Lott 2001-03-26 11:51:32 +00:00
parent cea7ef4b6e
commit 8f06203fe7

View File

@ -64,7 +64,7 @@
$error[$totalerrors++] = lang('The two passwords are not the same');
}
if (!count($account_permissions) || !count($account_groups))
if (!count($account_permissions) && !count($account_groups))
{
$error[$totalerrors++] = lang('You must add at least 1 permission or group to this account');
}
@ -113,6 +113,8 @@
$apps->account_type = 'u';
$apps->account_id = $account_id;
$apps->account_apps = Array(Array());
if ($account_permissions) {
@reset($account_permissions);
while ($app = each($account_permissions))
{
@ -125,14 +127,18 @@
}
}
}
}
$apps->save_repository();
// Assign user to groups
if ($account_groups) {
for ($i=0;$i<count($account_groups);$i++)
{
$phpgw->acl->add_repository('phpgw_group',$account_groups[$i],$account_id,1);
}
}
if ($apps_after) {
$pref = CreateObject('phpgwapi.preferences',$account_id);
$phpgw->common->hook_single('add_def_pref','admin');
while ($apps = each($apps_after))
@ -143,6 +149,7 @@
}
}
$pref->save_repository(False);
}
$apps->account_apps = Array(Array());
$apps_after = Array(Array());