NAME
Net::LDAP::Class::User::POSIX - user class for POSIX LDAP schema
SYNOPSIS
# subclass this class for your local LDAP
package MyLDAPUser;
use base qw( Net::LDAP::Class::User::POSIX );
__PACKAGE__->metadata->setup(
base_dn => 'dc=mycompany,dc=com',
attributes => __PACKAGE__->POSIX_attributes,
unique_attributes => __PACKAGE__->POSIX_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, uid => '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::POSIX isa Net::LDAP::Class::User implementing the POSIX LDAP schema.
CLASS METHODS
POSIX_attributes
Returns array ref of default POSIX attributes.
POSIX_unique_attributes
Returns array ref of unique POSIX attributes: uid and uidNumber.
OBJECT METHODS
All the init_* methods can be specified to the new() constructor without the init_ prefix.
init_default_shell
Returns /bin/bash.
init_default_home_dir
Returns /home.
init_default_email_suffix
Returns an empty string.
action_for_create([ uid => username, uidNumber => nnn ])
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, $gecos, $email, $passwordHash
action_for_update
Returns array ref suitable for creating a Net::LDAP::Batch::Action::Update.
action_for_delete
Returns hash ref suitable for creating a Net::LDAP::Batch::Action::Delete.
fetch_group
Required MethodMaker method for retrieving primary group from LDAP.
Returns an object of type group_class().
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 for same data as fetch_groups().
See the advice in Net::LDAP::Class::Iterator about iterators versus arrays.
gid
Alias for gidNumber() attribute.
password([plain_password])
Convenience wrapper around userPassword() attribute method.
This method will SHA-1-hashify plain_password using ssha_hash() and set the hash in the ldap_entry(). If no argument is supplied, returns the hash string set in ldap_entry() (if any).
new_password([len])
Returns a SHA-1-hashed password from a random string of length len. Default length is 8 characters. This method is just a simple wrapper around ssha_hash() and random_string().
ssha_hash( string )
Returns seeded hash of string using SHA-1. See http://www.openldap.org/faq/data/cache/347.html
NOTE: The hash will contain the LDAP-required {SSHA}
prefix. If the prefix is already present, will return string untouched.
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:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
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