On my screen 1 I am having multiple controls like button,textbox etcWhat I am trying to do is I want to assign security group to controls present on my screen using script module.

AMitchneck

Post subject: Re: Assign Security Group

Posted: Thu Jul 06, 2017 8:30 am

Joined: Mon Jun 11, 2012 2:10 pmPosts: 119

Hi ParthDesai,

What is it exactly you are trying to do? On the screen you can configure controls to be hidden, disabled, etc. based on user access level. Are you trying to control what the user can do from the script side? For instance, if they are low-level user pressing button does A, but if they are high-level user it does B?

If you are looking at the latter case, you can determine if the user is in a specific group using a function like this:

I have two system.windows.Form.Button control on my third party user control and wanted to give administrator access to one of the button using C#. So wanted to know how I can give access to one of the button through script or through code in my usercontrol.

AMitchneck

Post subject: Re: Assign Security Group

Posted: Thu Jul 06, 2017 3:25 pm

Joined: Mon Jun 11, 2012 2:10 pmPosts: 119

OK.

When you say "give administrator access" do you mean log them in as an administrator? To do this you could specify a username and password to the login function like so:

Code:

Globals.Security.Login("userName", "password");

If you want, you can pre-check if the user is already logged in as administrator via the code I supplied in my prior post (also below). Note this requires that the user does not change the password for the account - I don't know if there is a way to determine the new password. (You can just supply the username and require the user to give the password.)

If you just want to make sure the user has Administrator privileges before the button does anything, you could use the following, using the function from my prior post in the button_click routine:

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum