Click here to Skip to main content
12,953,379 members (52,378 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi I've done some research on this matter but can't find a real answer for this: The company needs to sync a user table with the active directory. We are using LDAP from a Oracle database to connect to the AD. Ok at first didn't sound hard BUT then researching how the Ad was organized it got complicated. The structure is at follows:

Active Directory Users and Computers
   +Saved Queries
   -Company.org
      -OrganizationalUnit(root this is where we start)
          -OU folder Regions
             +OU folder Computers
             -OU folder Users
                +Users we need
      +Other Stuff

The problem is the subtree its divided on Organizational units nested on organizational units. I've tried different approaches and as far as I have got is to list the OU Users Names, NOT the users instead, and list the OU of regions too. Just need a point in the right directions.
Posted 30-Aug-12 2:31am
Updated 30-Aug-12 2:38am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Ok i solved my issue,
 
Active Directory Users and Computers  
   +Saved Queries
   -Company.org
      -OrganizationalUnit <-----Starting Position
          -OU folder Regions
             +OU folder Computers
             -OU folder Users
                +Users we need
      +Other Stuff


Aparently using the DBMS_LDAP.SCOPE_SUBTREE it let me browse through all my starting position and all in between. Just had to tweak the filter to provide the users, its final form was:
(&(&(objectCategory=user)(objectClass=user)(memberOf=*)(samaccountname='||LDAP_USER||')))

Finally i got PL/SQL procedure that searches the Active Directory and updates the users table with a valid AD email :)
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,930


Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 7 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100