Groups can now be choosen when editing a person. Group management to follow.
Stricter error-handling in the lib..
my $msg;
+ die unless ($bind_dn and $base_dn and $uri and defined ($passwd));
+
$Ldap = Net::LDAP->new ($uri);
$msg = $Ldap->bind ($bind_dn, password => $passwd);
my $print = defined ($FieldNames{$field}) ? $FieldNames{$field} : $field;
my @values = @{$contacts->{$field}};
- next if (!$UserID and $field eq 'group');
+ next if ($field eq 'group');
push (@values, '');
}
}
+ if ($UserID)
+ {
+ my %c_groups = map { $_ => 1 } (@{$contacts->{'group'}});
+ my %a_groups = ();
+ my @a_persons = LiCoM::Person->search ();
+
+ for (@a_persons)
+ {
+ $a_groups{$_} = 1 for ($_->get ('group'));
+ }
+
+ print "\t\t\t<tr>\n",
+ "\t\t\t\t<th>", $FieldNames{'group'}, "</th>\n",
+ qq(\t\t\t\t<td><select name="group" multiple="multiple">\n);
+ for (sort (keys %a_groups))
+ {
+ my $group = $_;
+ my $selec = defined ($c_groups{$group}) ? ' selected="selected"' : '';
+
+ print qq(\t\t\t\t\t<option value="$group"$selec>$group</option>\n);
+ }
+ print "\t\t\t\t</select></td>\n",
+ "\t\t\t</tr>\n";
+ }
+
print <<EOF;
<tr>
<th colspan="2" class="menu">
$Config = get_config ();
}
+if ($ENV{'DEBUG'})
+{
+ require Data::Dumper;
+ print STDERR Data::Dumper->Dump ([$Config], ['Config']);
+}
+
unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'})
and defined ($Config->{'password'}))
{
print STDOUT scalar (@Matches), ' ', (scalar (@Matches) == 1 ? 'entry' : 'entries'), " found.\n";
-for (@Matches)
+for (sort { $a->name () cmp $b->name () } (@Matches))
{
my $person = $_;
my $cn = $person->name ();
my @mail = $person->get ('mail');
+ my @groups = $person->get ('group');
+ my $info = join (', ', sort (@groups));
+
+ $info = "($info)" if ($info);
- for (@mail)
+ for (sort (@mail))
{
- print "$_\t$cn\tFound by LiCoM\n";
+ print "$_\t$cn\t$info\n";
}
}