| 1 | package OpenInteract2::SPOPS::LDAP; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | # $Id: LDAP.pm,v 1.8 2005/03/18 04:09:51 lachoy Exp $ | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base qw( OpenInteract2::SPOPS ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use OpenInteract2::Context qw( CTX ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 1 | $OpenInteract2::SPOPS::LDAP::VERSION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | # See OpenInteract2::Config::Initializer for initialization behavior | ||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||
| 14 | # TODO: Ensure stub is in SPOPS::LDAP for this | ||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub connection_info { | ||||||||||||||||||||||||||||||||
|
Subroutine
connection_info: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 17 | 0 | my ( $self, $connect_key ) = @_; | |||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | $connect_key ||= $self->get_connect_key(); | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$connect_key ||= $self->get_connect_key
MC/DC0%0/2
$connect_key ||= $self->get_connect_key
$connect_key
$self->get_connect_key
Truth table0%0/3
A ||= B
A= $connect_keyB= $self->get_connect_key
| |||||||||||||||||||||||||||||||||||
| 19 | 0 | return \%{ $self->global_config->{datasource}{ $connect_key } }; | |||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | # TODO: Move this to SPOPS::LDAP and document | ||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub base_dn { | ||||||||||||||||||||||||||||||||
|
Subroutine
base_dn: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 26 | 0 | my ( $class, $connect_key ) = @_; | |||||||||||||||||||||||||||||||||
| 27 | 0 | my $partial_dn = $class->get_partial_dn( $connect_key ); | |||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | unless ( $partial_dn ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 29 | 0 | die "No Base DN defined in SPOPS configuration key 'ldap_base_dn', cannot continue!\n"; | |||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||
| 31 | 0 | my $connect_info = $class->connection_info( $connect_key ); | |||||||||||||||||||||||||||||||||
| 32 | 0 | return join( ',', $partial_dn, $connect_info->{base_dn} ); | |||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||
| 36 | # Retrieves the connect key when none is passed in | ||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||
| 38 | # TODO: Move this (minus the 'global_config' option) to SPOPS::LDAP | ||||||||||||||||||||||||||||||||||
| 39 | # and document | ||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub get_connect_key { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_connect_key: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 42 | 0 | my ( $class ) = @_; | |||||||||||||||||||||||||||||||||
| 43 | my $connect_key = $class->CONFIG->{datasource} || | ||||||||||||||||||||||||||||||||||
| 44 | $class->global_config->{datasource}{default_connection_ldap} || | ||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $class->global_config->{default_connection_ldap}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
$class->CONFIG->{'datasource'} || $class->global_config->{'datasource'}{'default_connection_ldap'} || $class->global_config->{'default_connection_ldap'}
$class->CONFIG->{"datasource"} or $class->global_config->{"datasource"}{"default_connection_ldap"}
MC/DC0%0/3
$class->CONFIG->{'datasource'} || $class->global_config->{'datasource'}{'default_connection_ldap'} || $class->global_config->{'default_connection_ldap'}
$class->CONFIG->{"datasource"}
$class->global_config->{"datasource"}{"default_connection_ldap"}
$class->global_config->{'default_connection_ldap'}
Truth table0%0/4
A or B || C
A= $class->CONFIG->{"datasource"}B= $class->global_config->{"datasource"}{"default_connection_ldap"}C= $class->global_config->{'default_connection_ldap'}
| |||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $connect_key = $connect_key->[0] if ( ref $connect_key eq 'ARRAY' ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 47 | 0 | return $connect_key; | |||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||
| 50 | # Retrieves the 'partial dn', or the section that's prepended to the | ||||||||||||||||||||||||||||||||||
| 51 | # server's 'base DN' to identify the branch on which these objects | ||||||||||||||||||||||||||||||||||
| 52 | # live | ||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | # TODO: Move this to SPOPS::LDAP (?) and document | ||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub get_partial_dn { | ||||||||||||||||||||||||||||||||
|
Subroutine
get_partial_dn: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 57 | 0 | my ( $class, $connect_key ) = @_; | |||||||||||||||||||||||||||||||||
| 58 | 0 | my $base_dn_info = $class->CONFIG->{ldap_base_dn}; | |||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | return $base_dn_info unless ( ref $base_dn_info eq 'HASH' ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $connect_key ||= $class->get_connect_key; | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
$connect_key ||= $class->get_connect_key
MC/DC0%0/2
$connect_key ||= $class->get_connect_key
$connect_key
$class->get_connect_key
Truth table0%0/3
A ||= B
A= $connect_keyB= $class->get_connect_key
| |||||||||||||||||||||||||||||||||||
| 61 | 0 | return $base_dn_info->{ $connect_key }; | |||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||||||||