• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting permission on certain part of an application

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

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.

Thanks,

Dalia
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a call to the Strategy pattern.

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.
 
Dalia Sultana
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic