Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set permissions on button click

Status
Not open for further replies.

slybitz

Technical User
Mar 25, 2005
113
US
I have setup a user group within Enterprise Manager. I have a program that I created that I am placing on several users machines. Some of these users are in the user group I have setup in EM and some are not. I want to grant access to those people that are in the user group within EM and deny those that are not in that group to be able to click a button and have some sort of action occur. How can I go about granting this access to a whole user group?

Thanks for the help!
 
Hello!

You can use windows authentication- role based. Have a look at this:
Code:
        Imports System.Security.Principal
        Imports System.Security.Permissions


	dim idWindows As WindowsIdentity
	dim prinWindows As WindowsPrincipal
	idWindows = WindowsIdentity.GetCurrent()
	prinWindows = New WindowsPrincipal(idWindows)

        if prinWindows.IsInRole( WindowsBuiltInRole.Administrator ) = True then
               ' the user is administrator!
        end if


The 'prinWindows.IsInRole(...)' is overloaded. Apart from the windows built-in, you can use a role name or a role id.

Hope this helps!
 
If your table has a list of user names you can use:
System.Environment.UserName.ToString
to find the name of the person logged on and compare that.
djj
 
Thanks guys. Not exactly what I was looking for but I'll see what I can do with that.
 
Have a look at the replies from gmmastros in thread183-1245548

He has written an SP that seems to do what you want.


Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top