Peter Karman > Net-LDAP-Class-0.26 > Net::LDAP::Class::User::AD

Download:
Net-LDAP-Class-0.26.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.26   Source  

NAME ^

Net::LDAP::Class::User::AD - Active Directory User class

SYNOPSIS ^

# subclass this class for your local LDAP package MyLDAPUser; use base qw( Net::LDAP::Class::User::AD );

 __PACKAGE__->metadata->setup(
    base_dn             => 'dc=mycompany,dc=com',
    attributes          => __PACKAGE__->AD_attributes,
    unique_attributes   => __PACKAGE__->AD_unique_attributes,
 );

 1;

 # then use your class
 my $ldap = get_and_bind_LDAP_object(); # you write this

 use MyLDAPUser;
 my $user = MyLDAPUser->new( ldap => $ldap, sAMAccountName  => 'foobar' );
 $user->read_or_create;
 for my $group ($user->group, @{ $user->groups }) {
     printf("user %s in group %s\n", $user, $group);
 }

DESCRIPTION ^

Net::LDAP::Class::User::AD isa Net::LDAP::Class::User implementing the Active Directory LDAP schema.

CLASS METHODS ^

AD_attributes

Returns array ref of a subset of the default Active Directory attributes. Only a subset is used since the default schema contains literally 100s of attributes. The subset was chosen based on its similarity to the POSIX schema.

AD_unique_attributes

Returns array ref of unique Active Directory attributes.

OBJECT METHODS ^

All the init_* methods can be specified to the new() constructor without the init_ prefix.

fetch_group

Required MethodMaker method for retrieving primary group from LDAP.

Returns an object of type group_class().

last_logon_localtime

Returns human-readable version of lastLogon attribute.

pwd_last_set_localtime

Returns human-readable version of pwdLastSet attribute.

ad_time_as_epoch( attribute_name )

Returns epoch time for attribute_name.

pwd_will_expire_localtime

Returns human-readable time when password will expire, based on pwdLastSet attribute and the domain-level maxPwdAge value.

fetch_groups

Required MethodMaker method for retrieving secondary groups from LDAP.

Returns array or array ref (based on context) of objects of type group_class().

groups_iterator([opts])

Returns a Net::LDAP::Class::Iterator object with all the secondary groups. This is the same data as fetch_groups() but as an iterator instead of an array.

See the advice about iterators versus arrays in Net::LDAP::Class::Iterator.

gid

Alias for primaryGroupID() attribute.

init_default_home_dir

Returns \home.

init_default_email_suffix

Returns an empty string.

password([plain_password])

Convenience wrapper around unicodePwd() attribute method.

This method will verify plain_password is in the correct encoding that AD expects and set it in the ldap_entry().

If no argument is supplied, returns the string set in ldap_entry() (if any).

action_for_create([ sAMAccountName => username ])

Returns hash ref suitable for creating a Net::LDAP::Batch::Action::Add.

May be called as a class method with explicit uid and uidNumber key/value pairs.

setup_for_write

Utility method for generating default values for various attributes. Called by both action_for_create() and action_for_update().

Returns array of values in this order:

 $groupname, $gid, $givenName, $sn, $cn, $email

action_for_update

Returns array ref suitable for creating a Net::LDAP::Batch::Action::Update.

action_for_delete

Returns action suitable for creating a Net::LDAP::Batch::Action::Delete.

AUTHOR ^

Peter Karman, <karman at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-net-ldap-class at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-LDAP-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Net::LDAP::Class

You can also look for information at:

ACKNOWLEDGEMENTS ^

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT ^

Copyright 2008 by the Regents of the University of Minnesota. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Net::LDAP

syntax highlighting: