Rechercher une page de manuel
Catalyst::Plugin::Authentication::Store::LDAP::User.3pm
Langue: en
Version: 2006-02-14 (mandriva - 01/05/08)
Section: 3 (Bibliothèques de fonctions)
NAME
Catalyst::Plugin::Authentication::Store::LDAP::User- A User object representing an LDAP object.
SYNOPSIS
You should be creating these objects through Catalyst::Plugin::Authentication::Store::LDAP::Backend's ``get_user'' method, or just letting $c->login do it for you.sub action : Local { my ( $self, $c ) = @_; $c->login($c->req->param(username), $c->req->param(password)); $c->log->debug($c->user->username . "is really neat!"); }
If you access just $c->user in a scalar context, it will return the current username.
DESCRIPTION
This wraps up an LDAP object and presents a simplified interface to it's contents. It uses some AUTOLOAD magic to pass method calls it doesn't understand through as simple read only accessors for the LDAP entries various attributes.It gets grumpy if you ask for an attribute via the AUTOLOAD mechanism that it doesn't know about. Avoid that with using ``has_attribute'', discussed in more detail below.
You can skip all that and just go straight to the Net::LDAP::Entry object through the ``ldap_entry'' method:
my $entry = $c->user->ldap_entry;
It also has support for Roles.
METHODS
new($store, $user)
new($store, $user)
Takes a Catalyst::Plugin::Authentication::Store::LDAP::Backend object as $store, and the data structure returned by that class's ``get_user'' method as $user.
Returns a Catalyst::Plugin::Authentication::Store::LDAP::User object.
id
Returns the results of the ``stringify'' method.
stringify
Uses the ``user_field'' configuration option to determine what the ``username'' of this object is, and returns it.
If you use the special value ``dn'' for user_field, it will return the DN of the Net::LDAP::Entry object.
check_password($password)
Bind's to the directory as the DN of the internal Net::LDAP::Entry object, using the bind password supplied in $password. Returns 1 on a successful bind, 0 on failure.
roles
Returns the results of Catalyst::Plugin::Authentication::Store::LDAP::Backend's ``lookup_roles'' method, an array of roles that are valid for this user.
ldap_entry
Returns the raw ldap_entry.
attributes($type)
Returns an array of attributes present for this user. If $type is ``ashash'', it will return a hash with the attribute names as keys. (And the values of those attributes as, well, the values of the hash)
has_attribute
Returns the values for an attribute, or undef if that attribute is not present. The safest way to get at an attribute.
AUTOLOADed methods
We automatically map the attributes of the underlying Net::LDAP::Entry object to read-only accessor methods. So, if you have an entry that looks like this one:
dn: cn=adam,ou=users,dc=yourcompany,dc=com cn: adam loginShell: /bin/zsh homeDirectory: /home/adam gecos: Adam Jacob gidNumber: 100 uidNumber: 1053 mail: adam@yourcompany.com uid: adam givenName: Adam sn: Jacob objectClass: inetOrgPerson objectClass: organizationalPerson objectClass: Person objectClass: Top objectClass: posixAccount
You can call:
$c->user->homedirectory
And you'll get the value of the ``homeDirectory'' attribute. Note that all the AUTOLOADed methods are automatically lower-cased.
Special Keywords
The highly useful and common method ``username'' will map to the configured value of user_field (uid by default.)
$c->user->username == $c->user->uid
AUTHORS
Adam Jacob <holoway@cpan.org>Some parts stolen shamelessly and entirely from Catalyst::Plugin::Authentication::Store::Htpasswd.
THANKS
To nothingmuch, ghenry, castaway and the rest of #catalyst for the help. :)SEE ALSO
Catalyst::Plugin::Authentication::Store::LDAP, Catalyst::Plugin::Authentication::Store::LDAP::Backend, Catalyst::Plugin::Authentication, Net::LDAPCOPYRIGHT & LICENSE
Copyright (c) 2005 the aforementioned authors. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre