Hi,
Looking for a small vbs (or asp) example to read all the groups a user is member of (or viceversa all members of a group) i got this working in a AD ldap configuration, now i need to do this against a novell E-directory LDAP.
getting confused with how to read "groupMembership"
can some show me which way to go
this works against AD ldap
Looking for a small vbs (or asp) example to read all the groups a user is member of (or viceversa all members of a group) i got this working in a AD ldap configuration, now i need to do this against a novell E-directory LDAP.
getting confused with how to read "groupMembership"
can some show me which way to go
this works against AD ldap
Code:
Attribute VB_Name = "ldapstuff"
Public Function ismemberof(sLdapusr As String, sLdapadr As String, sLdapgrp As String) As Boolean
On Error GoTo Errhandler
sLdapusr = LCase(sLdapusr)
sLdapadr = LCase(sLdapadr)
sLdapgrp = LCase(sLdapgrp)
Set objUser = GetObject("LDAP://cn=" & sLdapusr & "," & sLdapadr)
arrstrGroups = objUser.GetEx("memberOf")
If Err.Number <> 0 Then
On Error GoTo 0
strgroups = ""
Else
On Error GoTo 0
strgroups = LCase(Join(arrstrGroups))
End If
If InStr(strgroups, "cn=" & sLdapgrp & ",") > 0 Then
ismemberof = True
Else
ismemberof = False
End If
GoTo FunctionEnd
Errhandler:
ismemberof = False