Re: LDAP_SCOPE_SUBTREE

From: Date: Sun, 26 Nov 2000 05:24:59 +0000
Subject: Re: LDAP_SCOPE_SUBTREE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27237@lists.php.net to get a copy of this message
thank you so much. ldap_list() is exactly what i'm looking for. would appreciate if you could spend some time to share your experience & knowledge on the following questions regarding ldap. i'll be using php to desig a web-based registration. there will be a drop down list on this web-based form to select the user's department. i've thought of 2 ways of dynamically populating the department drop-down list: Method 1. design the ldap name space to contain department name and limit the ldap query to one level (from root: dc=mycompany, dc=com) to retrieve all the departments: i.e. uid=username, o=departmentname, dc=mycompany, dc=com Method 2. store the department name in a mysql database and dynamically populate the drop-down list by querying mysql. my worries about method 1 is whether the php API can perform the following tasks: 1. if the department changes name, how can i update the dn of all the users under this department tree? 2. if a user change department, how can i update his dn to uid=username, o=newdept, dc=mycompany, dc=com? 3. how can i delete a department and all the entries under it's tree? 4. is including the o=department in the dn a good design? or should i just use "uid=username, dc=mycompany,dc=com"? 5. what are the pros and cons of using "o" in the dn? using method 2, the name space design is simpler: uid=username, dc=mycompany, dc=com. but i have to keep duplicate/two sets of department records. one in mysql and one in ldap. and they must be synchronise when any department is modified, deleted or added. i really have no idea what might be the complications for each method and which is a better way of designing. ldap will also be used of authentication other than storing the department name. thank you so much. ----- Original Message ----- From: Ignacio Vazquez-Abrams <ignacio@openservices.net> To: Corisen <csyap@starnet.gov.sg> Cc: <php-general@lists.php.net> Sent: Sunday, November 26, 2000 1:14 PM Subject: Re: [PHP] LDAP_SCOPE_SUBTREE > On Sun, 26 Nov 2000, Corisen wrote: > > > i'm not sure though as i've yet to get all components setup properly to test > > it. would like to check out php ldap handling capability first to see if it > > can perform a one level search. > > > > i'm thinking that passing "o=branch1, dc=company, dc=com" might not limit to > > search to one level (at the 2nd level), but will search the 3 level > > downwards as well. > > > > is there anyone who has successfully one-level ldap search? > > > > where can i find more examples/resources on php + ldap? > > > > thanks. > > > > ----- Original Message ----- > > From: Ignacio Vazquez-Abrams <ignacio@openservices.net> > > To: Corisen <csyap@starnet.gov.sg> > > Cc: <php-general@lists.php.net> > > Sent: Sunday, November 26, 2000 1:04 PM > > Subject: Re: [PHP] LDAP_SCOPE_SUBTREE > > > > > > > On Sun, 26 Nov 2000, Corisen wrote: > > > > > > > thanks for your reply. > > > > > > > > suppose i have: > > > > dn: dc=company, dc=com <--root /1st level > > > > dn: o=branch1, dc=company, dc=com <-2nd level > > > > dn: ou=deparment1, o=branch1, dc=company, dc=com <--3rd level > > > > > > > > how can i limit the search to only 2nd level (o=branch1, dc=company, > > dc=com) > > > > using php ldap_search? > > > > > > > > ----- Original Message ----- > > > > From: Ignacio Vazquez-Abrams <ignacio@openservices.net> > > > > To: Corisen <csyap@starnet.gov.sg> > > > > Cc: <php-general@lists.php.net> > > > > Sent: Sunday, November 26, 2000 12:56 PM > > > > Subject: Re: [PHP] LDAP_SCOPE_SUBTREE > > > > > > > > > > > > > On Sun, 26 Nov 2000, Corisen wrote: > > > > > > > > > > > hi, the following ldap_search desription was given in the php > > manual: > > > > > > "ldap_search() performs the search for a specified filter on the > > > > directory > > > > > > with the scope of LDAP_SCOPE_SUBTREE." > > > > > > > > > > > > pls advice how can i change the LDAP_SCOPE_SUBTREE to limit the > > search > > > > to > > > > > > only one level in a subtree. > > > > > > > > > > > > thanks. > > > > > > > > > > > > > > > > Read a bit further: > > > > > > > > > > "base_dn specifies the base DN for the directory." > > > > > > > > > > -- > > > > > Ignacio Vazquez-Abrams <ignacio@openservices.net> > > > > > > > > > > > > > > > Pass "o=branch1, dc=company, dc=com" as base_dn, no? > > > > > > -- > > > Ignacio Vazquez-Abrams <ignacio@openservices.net> > > > > > > > Oh, then you probably want ldap_list() instead. > > -- > Ignacio Vazquez-Abrams <ignacio@openservices.net> >

« previous php.general (#27237) next »