오늘부터는 가끔씩 Windows2000의 Active Directory와 기존 Site Server 3.0의 Personalization & Membership의 LDAP을 비교하고, 사용법의 차이에 대해서 간략히 설명하겠습니다.


1. Site Server LDAP


*********************************************

***** LDAP Object의 일반적 사용형태 *****

*********************************************

Dim ds As IADsOpenDSObject

Dim oOu As IADsContainer

Dim oContainer As IADsContainer

Dim User As IADs


Set ds = GetObject("LDAP:")

Set oOu = ds.OpenDSObject(path, id, password)

Set oContainer = oOu.GetObject("member", "ou=members")


조회 : Set User = oContainer.GetObject("member", "cn=USERID")

생성 : Set User = oContainer.Create("member", "cn=USERID")

삭제 : oContainer.Delete "member", "cn=USERID"

---------------------------------------------------------------------------------

path : "LDAP://127.0.0.1/o=skt"

id : "cn=administrator, ou=members, o=skt"

password : "password"


- 새로운 속성 추가(Create)

User.Put [Attribute], [contents]

User.SetInfo


- 기존속성에서 삭제, 수정, 추가

User.Put [Attribute], [contents] 또는,

User.PutEx 1, [Attribute], [contents]


ADS_PROPERTY_CLEAR = 1,

ADS_PROPERTY_UPDATE = 2,

ADS_PROPERTY_APPEND = 3,

ADS_PROPERTY_DELETE = 4


' Adding a value

x.PutEx ADS_PROPERTY_APPEND, "OtherhomePhone", Array("333-3333") 

x.SetInfo 'Now the values are 111-1111,222-222,333-3333


' deleting two values

x.PutEx ADS_PROPERTY_DELETE, "OtherHomePhone", Array("111-1111", "222-2222")

x.SetInfo 'Now the values are 333-3333


' changing the remaining value

x.PutEx ADS_PROPERTY_UPDATE, "OtherHomePhone", Array("888-8888", "999-9999")

x.SetInfo 'Now the values are 888-8888,999-9999


'Deleting the value.

x.PutEx ADS_PROPERTY_CLEAR, "OtherHomePhone", vbNullString

x.SetInfo 'Now the property has no value


- 속성 읽기

txtUserID.Text = User.Get("UserID")


Dim cel, CelPhone As Variant

CelPhone = User.GetEx("CelPhone")

i = 0

For Each cel In CelPhone

txtCelPhone(i).Text = CStr(cel)

i = i + 1

Next



2. Active Directory


*********************************************

***** Windows 2000 Active Directory *****

*********************************************

Dim ds As IADsOpenDSObject

Dim oOu As IADsContainer

Dim oContainer As IADsContainer

Dim User As IADsUser


Set ds = GetObject("LDAP:")

Set oOu = ds.OpenDSObject(path, id, password)

Set oContainer = oOu.GetObject("User", "ou=Members")

조회 : Set User = oContainer.GetObject("User", "cn=USERID")

생성 : Set User = oContainer.Create("User", "cn=USERID")

삭제 : oContainer.Delete "User", "cn=USERID"

---------------------------------------------------------------------------------

path : "LDAP://192.168.0.2/dc=nets, dc=co, dc=kr"

id : "cn=administrator, ou=Users, dc=nets, dc=co, dc=kr"

password : "password"


- 새로운 속성 추가(Create)

User.Put [Attribute], [contents]

User.SetInfo


- 기존속성에서 삭제, 수정, 추가

User.Put [Attribute], [contents] 또는,

User.PutEx 1, [Attribute], [contents]


ADS_PROPERTY_CLEAR = 1,

ADS_PROPERTY_UPDATE = 2,

ADS_PROPERTY_APPEND = 3,

ADS_PROPERTY_DELETE = 4


- 속성 읽기

txtUserID.Text = User.Get("UserID") 또는

txtUserID.Text = User.UserID



이상 간략하게 사용법의 차이에 대해 알아보았습니다.




Posted by 떼르미
,


자바스크립트를 허용해주세요!
Please Enable JavaScript![ Enable JavaScript ]