X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=licom.cgi;h=58c88ccfd1f22b1d19f8abd81a26ca5c7b8e3856;hb=088609f68349c6888d73aaa60708d7bab4a8e7d0;hp=4af14ad7b37a84e185cf24b420d28fc7502891fd;hpb=0b46496344123e462825844a676997b77823b365;p=licom.git diff --git a/licom.cgi b/licom.cgi index 4af14ad..58c88cc 100755 --- a/licom.cgi +++ b/licom.cgi @@ -9,10 +9,11 @@ use CGI::Carp (qw(fatalsToBrowser)); use URI::Escape; use Data::Dumper; -use Person; +use LiCoM::Config (qw(get_config)); +use LiCoM::Person; our $Debug = 0; -our %Config = (); +our $Config = {}; our @MultiFields = (qw(address homephone cellphone officephone fax mail uri group)); @@ -43,24 +44,29 @@ our %Actions = save => [\&html_start, \&action_save, \&html_end], search => [\&html_start, \&action_search, \&html_end], verify => [\&html_start, \&action_verify, \&html_end], + delete => [\&html_start, \&action_ask_del, \&html_end], + expunge => [\&html_start, \&action_do_del, \&html_end], vcard => \&action_vcard ); -read_config (); +$Config = get_config (); # make sure AuthLDAPRemoteUserIsDN is enabled. die unless ($ENV{'REMOTE_USER'}); -$Config{'base_dn'} = $ENV{'REMOTE_USER'}; +$Config->{'base_dn'} = $ENV{'REMOTE_USER'}; -Person->connect +die unless (defined ($Config->{'uri'}) and defined ($Config->{'base_dn'}) + and defined ($Config->{'bind_dn'}) and defined ($Config->{'password'})); + +LiCoM::Person->connect ( - uri => $Config{'uri'}, - base_dn => $Config{'base_dn'}, - bind_dn => $Config{'bind_dn'}, - password => $Config{'password'} + uri => $Config->{'uri'}, + base_dn => $Config->{'base_dn'}, + bind_dn => $Config->{'bind_dn'}, + password => $Config->{'password'} ) or die; -our ($UserCN, $UserID) = Person->get_user ($Config{'base_dn'}); +our ($UserCN, $UserID) = LiCoM::Person->get_user ($Config->{'base_dn'}); if (!$UserID and $Action ne 'save') { @@ -89,9 +95,7 @@ elsif (ref ($Actions{$Action}) eq 'ARRAY') } } -#print qq#
Authenticated as ($UserCN, $UserID, #, $Config{'base_dn'}, qq#)
\n#; - -Person->disconnect (); +LiCoM::Person->disconnect (); exit (0); @@ -106,15 +110,16 @@ sub action_browse my @all; if ($group) { - @all = Person->search ([[group => $group]]); + @all = LiCoM::Person->search ([[group => $group]]); } else { - @all = Person->search (); + @all = LiCoM::Person->search (); } if (!$group) { + my @nogroup = (); my %groups = (); for (@all) { @@ -122,7 +127,10 @@ sub action_browse my @g = $person->get ('group'); $groups{$_} = (defined ($groups{$_}) ? $groups{$_} + 1 : 1) for (@g); + + push (@nogroup, $person) if (!@g); } + @all = @nogroup; print qq(\t\t

Contact Groups

\n\t\t