#!/usr/bin/perl use strict; use warnings; use lib (qw(lib)); use CGI (':cgi'); use CGI::Carp (qw(fatalsToBrowser)); use URI::Escape; use Data::Dumper; use Person; our $Debug = 0; our %Config = (); our @MultiFields = (qw(address homephone cellphone officephone fax mail uri group)); our %FieldNames = ( address => 'Address', homephone => 'Home Phone', cellphone => 'Cell Phone', officephone => 'Office Phone', fax => 'FAX', mail => 'E-Mail', uri => 'URI (Homepage)', group => 'Group' ); our $MySelf = $ENV{'SCRIPT_NAME'}; our $Action = param ('action'); $Action ||= 'default'; our %Actions = ( browse => [\&html_start, \&action_browse, \&html_end], default => [\&html_start, \&action_browse, \&html_end], detail => [\&html_start, \&action_detail, \&html_end], edit => [\&html_start, \&action_edit, \&html_end], save => [\&html_start, \&action_save, \&html_end], search => [\&html_start, \&action_search, \&html_end], verify => [\&html_start, \&action_verify, \&html_end], vcard => \&action_vcard ); read_config (); # make sure AuthLDAPRemoteUserIsDN is enabled. die unless ($ENV{'REMOTE_USER'}); $Config{'base_dn'} = $ENV{'REMOTE_USER'}; Person->connect ( 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'}); if (!$UserID and $Action ne 'save') { $Action = 'edit'; } if (!$UserCN) { die; } if (!defined ($Actions{$Action})) { die; } if (ref ($Actions{$Action}) eq 'CODE') { $Actions{$Action}->(); } elsif (ref ($Actions{$Action}) eq 'ARRAY') { for (@{$Actions{$Action}}) { $_->(); } } #print qq#
Lastname | EOF if ($UserID) { print qq(\t\t\t\t\n); } else { print qq(\t\t\t\t | $lastname | \n); } print <|||||
---|---|---|---|---|---|---|---|
Firstname | EOF if ($UserID) { print qq(\t\t\t\t\n); } else { print qq(\t\t\t\t | $firstname | \n); } print "\t\t\t
EOF
if ($UserID)
{
print < |