Hello,

I have problem with LDAP-Models, which I wanna access from outside.
When I use the LDAP-Model from a Controller I get all attributes I was querying for, means everything works fine :-)

# inside a Controller
my $mesg = $c->model('SimAuth')->getPerson('lu21rup');
$c->log->debug("\$LDAP-mesg: ".Dumper($mesg));

My LDAP-Model uses a Connection- & an Entry-Class, which are defined in the config:

  1 <Model::SimAuth>
  2         base   ou=ccc,ou=bbb,o=aaa,c=de
  3         password   xxx
  4 <start_tls_options>
  5                 verify   none
  6 </start_tls_options>
  7         port        50636
  8         start_tls   0
  9         dn   cn=ttt,ou=ddd,o=aaa,c=de
 10         host   ldaps://hostname.bla.de
 11         entry_class DW::Model::SimAuth::Entry
 12         connection_class    DW::Model::SimAuth::Connection
 13 </Model::SimAuth>


here are the 2 example-classes

  1 package DW::Model::SimAuth::Connection;
  2
  3 use strict;
  4 use warnings;
  5
  6 use Moose;
  7 use MooseX::NonMoose;
  8 use namespace::autoclean;
  9
 10 extends qw/Catalyst::Model::LDAP::Connection/;
 11
 12
 13 sub getPerson {
 14         my ($self, $person) = @_;
 15
 16         my $mesg = $self->search("(cn=".$person.")");
 17         return  $mesg;
 18 }
 19
 20 __PACKAGE__->meta->make_immutable;
 21
 22 1;



  1 package DW::Model::SimAuth::Entry;
  2
  3 use strict;
  4 use warnings;
  5
  6 use Moose;
  7 use MooseX::NonMoose;
  8 use namespace::autoclean;
  9
 10
 11 extends qw/Catalyst::Model::LDAP::Entry/;
 12
 13 sub getEntry {
 14         my ($self, $attribute) = @_;
 15
 16         return $self->get_value($attribute);
 17 }
 18
 19 __PACKAGE__->meta->make_immutable;
 20
 21 1;


... but when I try to access the model from the outside I just get a view attributes, not all???!? This means I can establish the connection externally but I think my script is definitely wrong. I use Config::JFDI for accessing the config from the outside (I have multiconfig enabled).

#!/usr/bin/perl

use strict;
use warnings;

use lib ('lib') ;
use Config::JFDI;
use DW::Model::SimAuth::Connection;
use DW::Model::SimAuth::Entry;
use Data::Dumper;


my $config = Config::JFDI->new(
        name => "DW",
        path => "../DW/conf",
        driver => {
                 'General' => { -UseApacheInclude => 1 }
        }
);

my $config_hash = $config->get;
print Dumper $config_hash;

my $ldap = $config_hash->{'Model::SimAuth'}->{'connection_class'}->new(%{$connect_info});

# query LDAP
my $mesg = $ldap->search(
        filter=>"&(cn=lu21rup)",
        scope  => 'sub',
        attrs  =>['*'],
);


my @entries = $mesg->entries;
foreach my $entry (@entries) {
        $entry->dump;
}


I think my failure is when I wanna get an instance of the connection-class:
my $ldap = $config_hash->{'Model::SimAuth'}->{'connection_class'}->new(%{$connect_info});

Can anybody help me?
thanx :-D








_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to