
? How to check user group membership
Another way that for me it was much more simple but it requires ADSI to be
installed in the machines.
references:
Active DS type library
Microsoft scriplet libray
Microsoft scripting runtime
Declare Function getusername Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Dim objNetwork
Dim strUserName As String
Dim UserObj
Dim Groupobj
get the user
Dim st As String
Dim slCnt As Long
Dim slDL As String
slCnt = 199
st = String(200, 0)
slDL = getusername(st, slCnt)
slusername = Left(st, slCnt) & slCnt
Text1.Text = slusername
strUserName =text1.text
see what groups the user is in
Set UserObj = GetObject("WinNT://domain/" & strUserName & ",user")
For Each Groupobj In UserObj.Groups
msgbox Groupobj.Name
next
Quote:
> I am a former VB programmer who has spent the past 3 years doing HTML and
is
> now very rusty, so be gentle with me...
> I need to write an ActiveX component to be accessed by ASP web pages.
Among
> the functions needed is the ability to check and see if logged on user X
is
> a member of global NT group Y. The component will be running on a machine
> that is a member of the domain containing X and Y. I thought this would be
> simple enough but the more I wade into the win API's the more confused I
> get! Can someone help? TIA! (Alternatively, if anyone knows of a free or
> VERY cheap component that includes this function, that would be swell
too).
> --
> Pete the WebGuy
> petek(at)archland(dot)com
> ..