? How to check user group membership 
Author Message
 ? How to check user group membership

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
..



Sun, 07 Sep 2003 00:01:29 GMT  
 ? How to check user group membership
Hi,

Well, you can do it by using the API programmation and use the
NetUserGetGroups function. I'm trying to use it with VB because all example
are in C++. Actually I have some problems with the pointeur structure in VB.
But it works, I have saw some example.

There is a lot of Network functions in API, you can find it in the MSDN from
Microsoft.

Good luck
And if someone can tell me how to use pointers under VB, i will be very
please.

Regards,
Jean Christophe THIBAUDET
AHLSTROM (France)


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
> ..



Sun, 07 Sep 2003 00:41:51 GMT  
 ? 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
> ..



Mon, 08 Sep 2003 17:55:30 GMT  
 ? How to check user group membership
Thank you for that info. We will be migrating to AD soon so I may just put
this project on hold until then.

WebGuy


Quote:
> 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


> > 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
> > ..



Fri, 12 Sep 2003 23:18:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to check a user's NT group membership

2. Checking Group membership from low-security user accounts.

3. Domain Integration - Checking Group Membership

4. Checking Group Membership

5. VBScript NT Login Script - checking for group membership

6. Checking for Group membership

7. Checking group membership

8. Checking Group Memberships

9. Checking NT Group Membership

10. Checking Group Membership for a Computer

11. error when checking for NT group membership

12. checking group membership like IFMEMBER

 

 
Powered by phpBB® Forum Software