MVP Pattern Philsophical Question - Security Checking in UI
Posted
by
Brian
on Programmers
See other posts from Programmers
or by Brian
Published on 2011-03-08T21:08:31Z
Indexed on
2011/03/09
0:18 UTC
Read the original article
Hit count: 347
design-patterns
|oop
Hello,
I have a philosophical question about the MVP pattern: I have a component that checks whether a user has access to a certain privilege. This privilege turns on or off certain UI features. For instance, suppose you have a UI grid, and for each row that gets bound, I do a security check to see if certain features in the grid should be enabled or disabled.
There are two ways to do this: have the UI/view call the component's method, determine if it has access, and enable/disable or show/hide. The other is have the view fire an event to the presenter, have the presenter do the check and return the access back down to the view through the model or through the event arg.
As per the MVP pattern, which component should security checks fit into, the presenter or the view? Since the view is using it to determine its accessibility, it seems more fitting in the view, but it is doing database checks and all inside this business component, and there is business logic there, so I can see the reverse argument too.
Thoughts?
Thanks.
© Programmers or respective owner