When you set a permission (example button.enabled = false) and then as part of the normal application logic when using the program the code tries to set the button to true, does visual guard stop the application from changing this property? If not, is there a nice way to do this?
There are several option to get this result:
1) Run the permission after the change done by the application: you can decide to apply a permission on an event of the application rather than on the initialization of the object. For example, you can disable (or enable) a control on the event 'EnabledChange' of the control(WinForm application) or on the 'PreRender' event (WebForm)application) or on an event which indicates that the state of the control has to be calculated again.
You are able to test directly in your appliction if the user has a permission and integrate this test in the logic of your application to determine if the control should be enabled or disabled.
If <MYLogic> = true and VGSecurityManager.Principal.HasPermission("MyPermission") then mybutton.Enabled = true
Visual Guard .NET
|