Extending Stripes
I'm currently working on a project that involves:
1. Multiple application roles
2. Multiple application views (or pages, if you'd like to call it that way)
3. Based on the view & the role, display the underlying model differently (either as editable field, or as label - i.e. non editable field.. or dont display at all).
The quick & dirty solution - to write the logic in the view. i.e. something like:
ifuserinrole role="Admin"
// display as editable field
ifuserinrole
and so on...
But that is ugly. The view decides the security setting.
I discussed this issue with my colleague, and we came up with an interesting idea. Basically, it involves having a separate security module that can be queried. Given the page, the role, and the field name, decides whether the field is editable/readable/hidden.
So I spent half a day today to write a prototype for this extension. It has been quite a while since I get excited about the code that I write.... so here is the idea...
1. The configuration is to be read on application start up. It will be nice if the config can be:
- changed during runtime
- have multiple implementation (file based / database based)
2. Configuration is available as Dependency Injectable bean, so that multiple views can use the configuration easily
3. Extend the current presentation framework to consult the configuration (using dependency injected configuration!), and display accordingly
I have achieved all three, except:
- changing configuration during runtime
- using database based configuration setting
So I'm quite a happy chap now.. :)

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home