|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is user admin?I want to know if a user has admin rightsSo I wrote the following code to check, if the user is in the admin-group: Dim bIsInRole as Boolean Dim myUser As Security.Principal.WindowsIdentity = Principal.WindowsIdentity.GetCurrent() Dim myPrincipal As New Principal.WindowsPrincipal(myUser) bIsInRole = myPrincipal.IsInRole(Principal.WindowsBuiltInRole.Administrator).ToString() Works fine, but now I have another problem: If the User is not in admin-group but in another group which belongs to the admins (or has admin-rights), my code doesn't work. Does anybody know how I can check if a group belongs to the admins? Or does anybody know about another way to check, if a user has admin-rights? Thanx, Norman What operation(s) do you want to perform ?
-- Patrice "Norman Chong" <normanch***@freenet.de> a écrit dans le message de news: 1164985577.774534.121***@73g2000cwn.googlegroups.com...Show quoteHide quote > Hi ng, > > I want to know if a user has admin rightsSo I wrote the following code > to check, if the user is in the admin-group: > > Dim bIsInRole as Boolean > Dim myUser As Security.Principal.WindowsIdentity = > Principal.WindowsIdentity.GetCurrent() > Dim myPrincipal As New Principal.WindowsPrincipal(myUser) > bIsInRole = > myPrincipal.IsInRole(Principal.WindowsBuiltInRole.Administrator).ToString() > > > Works fine, but now I have another problem: If the User is not in > admin-group but in another group which belongs to the admins (or has > admin-rights), my code doesn't work. > > Does anybody know how I can check if a group belongs to the admins? > Or does anybody know about another way to check, if a user has > admin-rights? > > Thanx, > Norman > Patrice wrote:
> What operation(s) do you want to perform ? Hi Patrice,I just want to check if my current user has admin rights to display a 'yes' or 'no' to the user. My application is a part of a setup for another application which needs those rights, that's why I have to check it. Norman
Offline application for reporting and collect data
Email Socket Question Report Viewer Asynchronous thread abort error Fastest String search Disable sort on specific columns with VB.NET datagrid Find Window Question What does this mean? Access and SQL server update component to show info vbc : Command line (0,0) : error BC2006: option 'r' requires':<file_list>' |
|||||||||||||||||||||||