}
}
- my %changed_groups = map { $_ => 1 } (param ('group'));
- my @current_groups = LiCoM::Group->load_by_member ($cn);
-
- for (@current_groups)
+ # only `authorized' users may see and change groups
+ if ($UserID)
{
- my $group_obj = $_;
- my $group_name = $group_obj->name ();
+ my %changed_groups = map { $_ => 1 } (param ('group'));
+ my @current_groups = LiCoM::Group->load_by_member ($cn);
- if (!defined ($changed_groups{$group_name}))
+ for (@current_groups)
{
- $group_obj->del_members ($cn);
+ my $group_obj = $_;
+ my $group_name = $group_obj->name ();
+
+ if (!defined ($changed_groups{$group_name}))
+ {
+ $group_obj->del_members ($cn);
+ }
+ else
+ {
+ delete ($changed_groups{$group_name});
+ }
}
- else
+ for (keys %changed_groups)
{
- delete ($changed_groups{$group_name});
+ my $group_name = $_;
+ my $group_obj = LiCoM::Group->load ($group_name) or die;
+
+ $group_obj->add_members ($cn);
}
- }
- for (keys %changed_groups)
- {
- my $group_name = $_;
- my $group_obj = LiCoM::Group->load ($group_name) or die;
- $group_obj->add_members ($cn);
+ if (param ('newgroup'))
+ {
+ # FIXME add error handling
+ my $group_name = param ('newgroup');
+ LiCoM::Group->create ($group_name, '', $cn);
+ }
}
- if (param ('newgroup'))
+ if (!$UserID)
{
- # FIXME add error handling
- my $group_name = param ('newgroup');
- LiCoM::Group->create ($group_name, '', $cn);
+ print <<HTML;
+ <h3>Your changes have been saved.</h3>
+ <p>Thank you very much for taking the time to keep this record up to date.</p>
+
+HTML
}
if ($button eq 'apply' or !$UserID)