From 89c58aa0c99bc2fd168fda98891ac2962ff16c94 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 15 Jun 2006 17:50:17 +0200 Subject: [PATCH] Change the layout assumed on the LDAP server. The layout now is something like this: (ou=LiCoM) + (ou=Group) ! + (cn=Group0) ! + (cn=Group1) ! + ... + (ou=Person) + (cn=Person One) + (cn=Person Two) + ... --- lib/LiCoM/Group.pm | 10 +++++----- lib/LiCoM/Person.pm | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/LiCoM/Group.pm b/lib/LiCoM/Group.pm index 39fd540..a5cade9 100644 --- a/lib/LiCoM/Group.pm +++ b/lib/LiCoM/Group.pm @@ -47,7 +47,7 @@ sub load my $mesg = $Ldap->search ( - base => get_config ('base_dn'), + base => 'ou=Group,' . get_config ('base_dn'), filter => "(&(objectClass=groupOfNames)(cn=$name))" ); @@ -76,7 +76,7 @@ sub load_by_member my $mesg = $Ldap->search ( - base => get_config ('base_dn'), + base => 'ou=Group,' . get_config ('base_dn'), filter => "(&(objectClass=groupOfNames)(member=$dn))" ); @@ -110,7 +110,7 @@ sub create ($$$@) my $desc = shift; my @members = @_; my $dn = _cn_to_dn ($name); - my ($ou) = get_config ('base_dn') =~ m/\bou\s*=\s*([^,]+)/i; + my $ou = 'Group'; my $entry = Net::LDAP::Entry->new (); @@ -146,7 +146,7 @@ sub all my $mesg = $Ldap->search ( - base => get_config ('base_dn'), + base => 'ou=Group,' . get_config ('base_dn'), filter => "(objectClass=groupOfNames)" ); @@ -308,7 +308,7 @@ sub _cn_to_dn my $cn = shift; my $base_dn = get_config ('base_dn') or die; - return ('cn=' . $cn . ',' . $base_dn); + return ('cn=' . $cn . ',ou=Group,' . $base_dn); } sub _update_members diff --git a/lib/LiCoM/Person.pm b/lib/LiCoM/Person.pm index 4ba1be4..3c43a4b 100644 --- a/lib/LiCoM/Person.pm +++ b/lib/LiCoM/Person.pm @@ -165,8 +165,8 @@ sub create return (undef); } - $dn = "cn=$sn $gn," . get_config ('base_dn'); - ($ou) = get_config ('base_dn') =~ m/\bou\s*=\s*([^,]+)/i; + $ou = 'Person'; + $dn = "cn=$sn $gn,ou=$ou," . get_config ('base_dn'); $entry->add (cn => "$sn $gn", ou => $ou); $entry->dn ($dn); @@ -257,7 +257,7 @@ sub search $mesg = $Ldap->search ( - base => get_config ('base_dn'), + base => 'ou=Person,' . get_config ('base_dn'), filter => $filter ); @@ -297,7 +297,7 @@ sub get_user my $mesg = $Ldap->search ( - base => get_config ('base_dn'), + base => 'ou=Person,' . get_config ('base_dn'), filter => "(cn=$search)" ); @@ -360,7 +360,7 @@ sub _update_dn my $sn = $obj->{'sn'}; my $gn = $obj->{'givenName'}; my $cn = "$sn $gn"; - my $dn = "cn=$cn," . get_config ('base_dn'); + my $dn = "cn=$cn,ou=Person," . get_config ('base_dn'); $obj->{'cn'} = $cn; -- 2.11.0