forked from extern/egroupware
stoping account or group creation process, if there is an error and therefor no id (else the acl or preference class assumes to change the current user)
This commit is contained in:
parent
2323808812
commit
cf32369b5d
@ -238,62 +238,64 @@
|
||||
'account_expires' => -1
|
||||
// 'account_file_space' => $account_file_space_number . "-" . $account_file_space_type,
|
||||
);
|
||||
$group->create($account_info);
|
||||
$group_info['account_id'] = $GLOBALS['phpgw']->accounts->name2id($group_info['account_name']);
|
||||
|
||||
$apps = CreateObject('phpgwapi.applications',$group_info['account_id']);
|
||||
$apps->update_data(Array());
|
||||
reset($group_info['account_apps']);
|
||||
while(list($app,$value) = each($group_info['account_apps']))
|
||||
$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'])
|
||||
{
|
||||
$apps->add($app);
|
||||
$new_apps[] = $app;
|
||||
}
|
||||
$apps->save_repository();
|
||||
|
||||
$acl = CreateObject('phpgwapi.acl',$group_info['account_id']);
|
||||
$acl->read_repository();
|
||||
|
||||
@reset($group_info['account_user']);
|
||||
while(list($user_id,$dummy) = each($group_info['account_user']))
|
||||
{
|
||||
if(!$dummy)
|
||||
$apps = CreateObject('phpgwapi.applications',$group_info['account_id']);
|
||||
$apps->update_data(Array());
|
||||
reset($group_info['account_apps']);
|
||||
while(list($app,$value) = each($group_info['account_apps']))
|
||||
{
|
||||
continue;
|
||||
$apps->add($app);
|
||||
$new_apps[] = $app;
|
||||
}
|
||||
$acl->add_repository('phpgw_group',$group_info['account_id'],$user_id,1);
|
||||
|
||||
$docommit = False;
|
||||
$GLOBALS['pref'] = CreateObject('phpgwapi.preferences',$user_id);
|
||||
$t = $GLOBALS['pref']->read_repository();
|
||||
@reset($new_apps);
|
||||
while(is_array($new_apps) && list($app_key,$app_name) = each($new_apps))
|
||||
$apps->save_repository();
|
||||
|
||||
$acl = CreateObject('phpgwapi.acl',$group_info['account_id']);
|
||||
$acl->read_repository();
|
||||
|
||||
@reset($group_info['account_user']);
|
||||
while(list($user_id,$dummy) = each($group_info['account_user']))
|
||||
{
|
||||
if (!$t[($app_name=='admin'?'common':$app_name)])
|
||||
if(!$dummy)
|
||||
{
|
||||
$GLOBALS['phpgw']->hooks->single('add_def_pref', $app_name);
|
||||
$docommit = True;
|
||||
continue;
|
||||
}
|
||||
$acl->add_repository('phpgw_group',$group_info['account_id'],$user_id,1);
|
||||
|
||||
$docommit = False;
|
||||
$GLOBALS['pref'] = CreateObject('phpgwapi.preferences',$user_id);
|
||||
$t = $GLOBALS['pref']->read_repository();
|
||||
@reset($new_apps);
|
||||
while(is_array($new_apps) && list($app_key,$app_name) = each($new_apps))
|
||||
{
|
||||
if (!$t[($app_name=='admin'?'common':$app_name)])
|
||||
{
|
||||
$GLOBALS['phpgw']->hooks->single('add_def_pref', $app_name);
|
||||
$docommit = True;
|
||||
}
|
||||
}
|
||||
if ($docommit)
|
||||
{
|
||||
$GLOBALS['pref']->save_repository();
|
||||
}
|
||||
}
|
||||
if ($docommit)
|
||||
|
||||
$acl->save_repository();
|
||||
|
||||
$basedir = $GLOBALS['phpgw_info']['server']['files_dir'] . SEP . 'groups' . SEP;
|
||||
$cd = 31;
|
||||
umask(000);
|
||||
if (! @mkdir ($basedir . $group_info['account_name'], 0707))
|
||||
{
|
||||
$GLOBALS['pref']->save_repository();
|
||||
$cd = 37;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->db->unlock();
|
||||
}
|
||||
|
||||
$acl->save_repository();
|
||||
|
||||
$basedir = $GLOBALS['phpgw_info']['server']['files_dir'] . SEP . 'groups' . SEP;
|
||||
$cd = 31;
|
||||
umask(000);
|
||||
if (! @mkdir ($basedir . $group_info['account_name'], 0707))
|
||||
{
|
||||
$cd = 37;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->db->unlock();
|
||||
|
||||
ExecMethod('admin.uiaccounts.list_groups');
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -357,10 +359,9 @@
|
||||
}
|
||||
|
||||
// do we have all needed data??
|
||||
if (!$errors = $this->validate_user($userData))
|
||||
if (!($errors = $this->validate_user($userData)) &&
|
||||
($userData['account_id'] = $account_id = $this->so->add_user($userData))) // no error in the creation
|
||||
{
|
||||
$userData['account_id'] = $account_id = $this->so->add_user($userData);
|
||||
|
||||
if ($userData['anonymous'])
|
||||
{
|
||||
$GLOBALS['phpgw']->acl->add_repository('phpgwapi','anonymous',$account_id,1);
|
||||
|
@ -156,6 +156,8 @@ enter your http proxy server setup de HTTP-Proxy-Server
|
||||
enter your http proxy server password setup de Passwort des HTTP-Proxy-Servers
|
||||
enter your http proxy server port setup de Port des HTTP-Proxy-Servers
|
||||
enter your http proxy server username setup de Benutzername des HTTP-Proxy-Servers
|
||||
error in admin-creation !!! setup de Fehler beim Anlegen des Admin-Kontos !!!
|
||||
error in group-creation !!! setup de Fehler beim Anlegen der Gruppen !!!
|
||||
export egroupware accounts from sql to ldap setup de eGroupWare Benutzerkonten von SQL nach LDAP exportieren
|
||||
export has been completed! you will need to set the user passwords manually. setup de Export ist abgeschlossen! Sie müssen die Benutzerpasswörter manuell setzen.
|
||||
export sql users to ldap setup de SQL-Benutzer in LDAP exportieren
|
||||
|
@ -152,6 +152,8 @@ enter your http proxy server setup en Enter your HTTP proxy server
|
||||
enter your http proxy server password setup en Enter your HTTP proxy server password
|
||||
enter your http proxy server port setup en Enter your HTTP proxy server port
|
||||
enter your http proxy server username setup en Enter your HTTP proxy server username
|
||||
error in admin-creation !!! setup en Error in admin-creation !!!
|
||||
error in group-creation !!! setup en Error in group-creation !!!
|
||||
export egroupware accounts from sql to ldap setup en Export eGroupWare accounts from SQL to LDAP
|
||||
export has been completed! you will need to set the user passwords manually. setup en Export has been completed! You will need to set the user passwords manually.
|
||||
export sql users to ldap setup en Export SQL users to LDAP
|
||||
|
@ -199,10 +199,12 @@
|
||||
'account_status' => 'A',
|
||||
'account_expires' => -1
|
||||
);
|
||||
$accounts->create($thisaccount_info);
|
||||
$thisacctid = $acct->name2id($thisacctlid);
|
||||
$thisacctid = $accounts->create($thisaccount_info);
|
||||
}
|
||||
if (!$thisacctid) // if we have no account_id, we cant continue
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Insert default acls for this user.
|
||||
// Since the group has app rights, we don't need to give users
|
||||
// these rights. Instead, we make the user a member of the Default group
|
||||
@ -279,10 +281,12 @@
|
||||
'account_status' => 'A',
|
||||
'account_expires' => -1
|
||||
);
|
||||
$groups->create($thisgroup_info);
|
||||
$thisacctid = $acct->name2id($thisacctlid);
|
||||
$thisacctid = $groups->create($thisgroup_info);
|
||||
}
|
||||
if (!$thisacctid) // if we have no account_id, we cant continue
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Now make them a member of this group in phpgw.
|
||||
while(list($key,$members) = each($thismembers))
|
||||
{
|
||||
|
@ -97,6 +97,14 @@
|
||||
/* Create the demo groups */
|
||||
$defaultgroupid = (int)$GLOBALS['phpgw_setup']->add_account('Default','Default','Group',False,False);
|
||||
$admingroupid = (int)$GLOBALS['phpgw_setup']->add_account('Admins','Admin','Group',False,False);
|
||||
|
||||
if (!$defaultgroupid || !$admingroupid)
|
||||
{
|
||||
echo '<p><b>'.lang('Error in group-creation !!!')."</b></p>\n";
|
||||
echo '<p>'.lang('click <a href="index.php">here</a> to return to setup.')."</p>\n";
|
||||
$GLOBALS['phpgw_setup']->db->transaction_abort();
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Group perms for the default group */
|
||||
$GLOBALS['phpgw_setup']->add_acl(array('addressbook','calendar','infolog','email','preferences'),'run',$defaultgroupid);
|
||||
@ -147,13 +155,20 @@
|
||||
if(get_var('create_demo',Array('POST')))
|
||||
{
|
||||
// Create 3 demo accounts
|
||||
$accountid = $GLOBALS['phpgw_setup']->add_account('demo','Demo','Account','guest');
|
||||
$accountid = $GLOBALS['phpgw_setup']->add_account('demo2','Demo2','Account','guest');
|
||||
$accountid = $GLOBALS['phpgw_setup']->add_account('demo3','Demo3','Account','guest');
|
||||
$GLOBALS['phpgw_setup']->add_account('demo','Demo','Account','guest');
|
||||
$GLOBALS['phpgw_setup']->add_account('demo2','Demo2','Account','guest');
|
||||
$GLOBALS['phpgw_setup']->add_account('demo3','Demo3','Account','guest');
|
||||
}
|
||||
|
||||
/* Create records for administrator account, with Admins as primary and Default as additional group */
|
||||
$accountid = $GLOBALS['phpgw_setup']->add_account($username,$fname,$lname,$passwd,'Admins',True);
|
||||
if (!$accountid)
|
||||
{
|
||||
echo '<p><b>'.lang('Error in admin-creation !!!')."</b></p>\n";
|
||||
echo '<p>'.lang('click <a href="index.php">here</a> to return to setup.')."</p>\n";
|
||||
$GLOBALS['phpgw_setup']->db->transaction_abort();
|
||||
exit;
|
||||
}
|
||||
$GLOBALS['phpgw_setup']->add_acl('phpgw_group',$admingroupid,$accountid);
|
||||
$GLOBALS['phpgw_setup']->add_acl('phpgw_group',$defaultgroupid,$accountid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user