[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: Enabling and disabling actions according to user priviledges
|
Hello Tom,
Thanks you for taking some time to answer my question, but I am not quite sure that the solution you proposed is the answer to my problem.
My actions implement IWorkbenchWindowActionDelegate, so according to what you said, that I make the security check in the init method (and throw an Exception if it fails..?). I guess this would prevent the action from initializing if the security check is not passed.
However, what I would like to do is hide and show actions according to the user priviledges. Let me explain this a little bit. I show my login dialog in the WorkbenchAdvisor.postStartup() method, so the user interface is already shown previous to the authentication. When the user has completed the login process, the software retrieves his granted privileges, and I want to populate the toolbars and menus with just the actions available to him, according to those privileges.
I have been digging and reading a lot since yesterday and I think I have found a mechanism that could do the trick nicely: define an Activity for each granted privilege, which would be bounded to the actions. This activities are disabled by default, so initially the interface would appear clean. After a successful login, I could enable the necessary activities by calling PlatformUI.getWorkbench().getActivitySupport().setEnabledActivityIds(..).
A nice thing about this solution is that anytime during the application life, I could enable or disable some of the activities again, for example, if the user authenticated again using a higher role.
I would greatly appreciate some opinions on this solution.
Regards,
C.A.