I am trying to enable/disable certain parts of an application depending on the user's role. Every dialog at start up checks for the role of the current user and enables or disables various parts. Somehow it doesn't seem that object oriented to me but can't think of a better way either. I was just wondering if there is a standard way to do this.
Put all your users into a HashMap, with objects representing their access status; loading that object at log-in time will activate and deactivate the appropriate parts of the application.
Joined: Jul 16, 2006
I am not sure, I follow your suggestion. Perhaps, I was unclear as to what it is that I am trying to achieve. The application has many dialogs with buttons, tables and checkboxes. Depending on what user is currently accessing it certain buttons/checkboxes need to disappear or become disabled. This is currently done at initialization of the dialog. I was wondering if there is a way to extract this part of the code out in a different module somehow. These bits and pieces of code check to see what role the user has and then enables/disables the appropriate buttons/checkboxes. I am not sure if this is the best way to this. I was just wondering if there is a standard/well accepted way to do this.