Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a list of logged in users roles(groups)
Message
De
22/01/2007 10:24:46
 
 
À
20/01/2007 10:08:45
Information générale
Forum:
ASP.NET
Catégorie:
Securité
Divers
Thread ID:
01187341
Message ID:
01187668
Vues:
16
>I have a window forms app I'm adding security to. How can I determine what groups the logged in user belongs to?

Something like this?

Imports System.Security.Principal

Dim CurrentUser As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim strUserName As String = Replace(CurrentUser.Name, "\", "/")
Dim objWMI As Object

objWMI = GetObject("WinNT://" & strUserName)

Dim Group As Object
Dim Groups As String = ""

For Each Group In objWMI.Groups()
Groups += Group.Name + vbCr
Next

MsgBox(Groups, MsgBoxStyle.Information, "Group memberships")
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform