Chris
11/2/2003 11:27:00 AM
Hi,
Regarding : Role based Security
Scenario :
On W2K, I'm currently logged in as 'user1'
Checking the properties of the user account 'user1' :
--> Start/Programs/Administrative Tools/Computer Management
In the 'Computer Management' app : opening System
Tools/Local users and Groups/Users
Tab: Member of
'Adminstrators'
Now, I have a test application (VB.NET) where I want to check what group the
currenty logged in user belongs to :
Private myWindowsPrincipal As WindowsPrincipal
Dim b As Boolean
myWindowsPrincipal = New
WindowsPrincipal(WindowsIdentity.GetCurrent())
b = myWindowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator)
===> b is TRUE : OK
b = myWindowsPrincipal.IsInRole(WindowsBuiltInRole.User)
===> b is TRUE ????
(b is always TRUE regardless of whether the current User actually
belongs to the 'Users' group or not)
I tried another syntax :
b = myWindowsPrincipal.IsInRole("MYPC\Users") ' MYPC is
the computer name
===> b is always FALSE ???? regardless of whether the current
User actually belongs to the 'Users' group or not
I tried yet another syntax :
b = myWindowsPrincipal.IsInRole("BUILTIN\Users")
===> b is always TRUE ???? regardless of whether the current
User actually belongs to the 'Users' group or not
Any ideas ?
Thanks