From: Florian Forster Date: Thu, 15 Jun 2006 15:50:17 +0000 (+0200) Subject: Change the layout assumed on the LDAP server. X-Git-Url: https://git.octo.it/?p=licom.git;a=commitdiff_plain;h=89c58aa0c99bc2fd168fda98891ac2962ff16c94 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) + ... --- 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;