takes into account having 0 apps enabled for the group

This commit is contained in:
skeeter 2001-02-10 19:54:32 +00:00
parent cf3564035a
commit 49d927b96a

View File

@ -49,11 +49,15 @@
$apps = CreateObject('phpgwapi.applications',intval($group_id)); $apps = CreateObject('phpgwapi.applications',intval($group_id));
$apps_before = $apps->read_account_specific(); $apps_before = $apps->read_account_specific();
$apps->update_data(Array()); $apps->update_data(Array());
while($app = each($n_group_permissions)) { $new_apps = Array();
if($app[1]) { if(isset($n_group_permissions)) {
$apps->add($app[0]); reset($n_group_permissions);
if(!$apps_before[$app[0]]) { while($app = each($n_group_permissions)) {
$new_apps[] = $app[0]; if($app[1]) {
$apps->add($app[0]);
if(!$apps_before[$app[0]]) {
$new_apps[] = $app[0];
}
} }
} }
} }
@ -75,24 +79,26 @@
$acl->add_repository('phpgw_group',$group_id,$n_users[$i],1); $acl->add_repository('phpgw_group',$group_id,$n_users[$i],1);
// If the user is logged in, it will force a refresh of the session_info // If the user is logged in, it will force a refresh of the session_info
$phpgw->db->query("update phpgw_sessions set session_info='' " $phpgw->db->query("update phpgw_sessions set session_action='' "
."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); ."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__);
// The following sets any default preferences needed for new applications.. // The following sets any default preferences needed for new applications..
// This is smart enough to know if previous preferences were selected, use them. // This is smart enough to know if previous preferences were selected, use them.
$pref = CreateObject('phpgwapi.preferences',intval($n_users[$i]));
$t = $pref->read_repository();
$docommit = False; $docommit = False;
for ($j=1;$j<count($new_apps) - 1;$j++) { if($new_apps) {
if($new_apps[$j]=='admin') { $pref = CreateObject('phpgwapi.preferences',intval($n_users[$i]));
$check = 'common'; $t = $pref->read_repository();
} else {
$check = $new_apps[$j]; for ($j=1;$j<count($new_apps) - 1;$j++) {
} if($new_apps[$j]=='admin') {
if (!$t[$check]) { $check = 'common';
$phpgw->common->hook_single('add_def_pref', $new_apps[$j]); } else {
$docommit = True; $check = $new_apps[$j];
}
if (!$t[$check]) {
$phpgw->common->hook_single('add_def_pref', $new_apps[$j]);
$docommit = True;
}
} }
} }
if ($docommit) { if ($docommit) {