This module implements a User object which returns information about a user.
my $user = new User ('adefaria');
-
+
print "Fullname: $user->{fullname}\n";
print "EMail: $user->{email}\n";
-
+
=head2 DESCRIPTION
-This module instanciates a user object for the given user identifier and
+This module instanciates a user object for the given user identifier and
then collects information about the user such as fullname, email, etc. It does
so by contacting Active Directory in a Windows domain or other directory servers
-depending on the site. As such exactly what data members are available may
+depending on the site. As such exactly what data members are available may
change or be different from site to site.
=cut
use warnings;
use Carp;
-use Net::LDAP;
+#use Net::LDAP;
use GetConfig;
our $VERSION = '$Revision: 1.4 $';
($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
-
+
# Override options if in the environment
$CLEAROPTS{CLEARUSER_LDAPHOST} = $ENV{CLEARUSER_LDAPHOST}
if $ENV{CLEARUSER_LDAPHOST};
sub GetOwnerInfo ($) {
my ($userid) = @_;
-
+
my @parts = split /(\/|\\)/, $userid;
if (@parts == 3) {
} # if
my $sso = unix2sso ($userid);
-
+
unless ($ldap) {
$ldap = Net::LDAP->new ($CLEAROPTS{CLEARUSER_LDAPHOST})
or croak 'Unable to create LDAP object';
-
+
$ad = $ldap->bind (
"$CLEAROPTS{CLEARUSER_USERNAME}\@$CLEAROPTS{CLEARUSER_BIND}",
password => $CLEAROPTS{CLEARUSER_PASSWORD});
} # unless
-
+
$ad = $ldap->search (
base => $CLEAROPTS{CLEARUSER_BASEDN},
filter => "(&(objectclass=user)(sAMAccountName=$sso))",
);
-
- $ad->code
+
+ $ad->code
&& croak $ad->error;
-
+
my @entries = $ad->entries;
my %ownerInfo;
-
+
if (@entries == 1) {
for (my $i = 0; $i < $ad->count; $i++) {
my $entry = $ad->entry ($i);
$ownerInfo{$attribute} = $entry->get_value ($attribute)
} # foreach
} # for
-
+
return %ownerInfo;
} else {
return;
- } # if
+ } # if
} # GetOwnerInfo
=pod
croak "Must specify userid to User constructor"
if @_ == 1;
-
+
my %members;
-
+
$members{id} = $userid;
-
+
my %ownerInfo = GetOwnerInfo ($userid);
-
+
$members{$_} = $ownerInfo{$_}
foreach (keys %ownerInfo);
-
+
return bless \%members, $class;
} # new
=head2 ClearSCM Perl Modules
-=begin man
+=begin man
GetConfig
=begin html
<blockquote>
-<a href="http://clearscm.com/php/cvs_man.php?file=lib/GetConfig.pm">GetConfig</a><br>
+<a href="http://clearscm.com/php/scm_man.php?file=lib/GetConfig.pm">GetConfig</a><br>
</blockquote>
=end html