Novell is now a part of Micro Focus

How can I remove a trustee (user or...

Articles and Tips: qna

01 Jan 2003


Q.

How can I remove a trustee (user or group) from an organizational unit object. What's the correct ocx-control and method?

A.

You can use the NWIDir* controls for eDirectory that supports LDAP, or the NWDir* controls if you have older versions of NDS that don't support LDAP (the latter requires Novell client).

If you want to use LDAP to access the directory, you might use the NWIDirEntries control. The trustees are stored in the ACL (Access Control List).

To list the ACL, see NWIDirEntries.GetFieldValue at http://developer.novell.com/ndk/doc/activex_ldap/ocx_ldap/ref/nwidirent/nwidirentries_nwentry_getfieldvalue_method.htm

The field you want to look at is "ACL." To remove one of the values, see NWIDirEntries.RemoveFieldValue at http://developer.novell.com/ndk/doc/activex_ldap /ocx_ldap/ref/nwidirent/nwidirentries_nwentry_removefieldvalue_method.htm

For more on the format of ACL, see: http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk794.html

In a VB application, I list all the ACLs on my ou=xou container object with the following:

Dim ACLs As Variant
Dim ACL As Variant
	
List1.Clear
List1.Refresh
	
NWIDirEntries1.FullName =
	"LDAP://localhost/o=novell"
NWIDirEntries1.UserName =
	"LDAP://localhost/o=novell/cn=admin"
NWIDirEntries1.Password = "novell"
	
NWIDirEntries1.Fields = "ACL"
Set entry = NWIDirEntries1.entries.Item("ou=xou")
Debug.Print entry.FullName
ACLs = entry.GetFieldValue("ACL")
For Each ACL In ACLs
	List1.AddItem (ACL)
Next
	
Then after selecting the one I wish to remove, I do the following:
	
	Dim str As String
	Dim ind As Integer
	str = List1.Text
	ind = List1.ListIndex
	
	entry.RemoveFieldValue "ACL", str
	entry.Update
	List1.RemoveItem (ind)
	List1.Refresh

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates