473,507 Members | 6,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make MVP Aware Of Security Model

I'm implementing the Model View Presenter (MVP) pattern in a Windows Forms
application. There is a need to control which forms (views) are accessible
by specific users, and for some forms (views) to enable/disable/hide
controls for certain users or groups.

For sake of this question, please go with the model being a Person object
and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI controls
enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff
Feb 17 '06 #1
5 1316
Hi Jeff,
If using a database, you can create table with columns like these:

UserGroupID (or UserID) NOT NULL
ParentFormSecurityToken NULL
ChildConrolSecurityToken NULL
LinkToParentForm NULL

Then decorate each form and conrol with attribute that will tell you wether
the user has permission or not.
[HasPermissions(string SecurityToken)]
The attribute class will load the permissions for that user and check to see
if they have access.

But of course, if anyone else has a better way of doing it please chime in
because I have to implement the same thing coming up real soon :)

--Patrick

"Jeff S" <A@B.COM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I'm implementing the Model View Presenter (MVP) pattern in a Windows Forms
application. There is a need to control which forms (views) are accessible
by specific users, and for some forms (views) to enable/disable/hide
controls for certain users or groups.

For sake of this question, please go with the model being a Person object
and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI
controls enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff

Feb 17 '06 #2
Yes, I'll be persisting the user security info to a database. I'm
particularly interested in integrating those settings with the MVP setup
without introducing nay new dependencies if possible and while
simultaneously keeping the forms and controls as dumb as possible. I'm not
familiar with the attribute-based approach you pointed out. Where can I find
more on that (yes I'll do some research on my own but was thinking/hoping
you might have a handy link or reference)?

-Jeff


"Patrick" <cparker@noharvesting> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
Hi Jeff,
If using a database, you can create table with columns like these:

UserGroupID (or UserID) NOT NULL
ParentFormSecurityToken NULL
ChildConrolSecurityToken NULL
LinkToParentForm NULL

Then decorate each form and conrol with attribute that will tell you
wether the user has permission or not.
[HasPermissions(string SecurityToken)]
The attribute class will load the permissions for that user and check to
see if they have access.

But of course, if anyone else has a better way of doing it please chime in
because I have to implement the same thing coming up real soon :)

--Patrick

"Jeff S" <A@B.COM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I'm implementing the Model View Presenter (MVP) pattern in a Windows
Forms application. There is a need to control which forms (views) are
accessible by specific users, and for some forms (views) to
enable/disable/hide controls for certain users or groups.

For sake of this question, please go with the model being a Person object
and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI
controls enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff


Feb 17 '06 #3
Well, this is something I've thought about. Can't really send you a link on
the topic.
I'm looking for an "easier" way to accomplish this myself. I believe that
Microsoft has a security application block that *might* come in handy. Keep
us posted if you have a eureka moment :)

"Jeff S" <A@B.COM> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Yes, I'll be persisting the user security info to a database. I'm
particularly interested in integrating those settings with the MVP setup
without introducing nay new dependencies if possible and while
simultaneously keeping the forms and controls as dumb as possible. I'm not
familiar with the attribute-based approach you pointed out. Where can I
find more on that (yes I'll do some research on my own but was
thinking/hoping you might have a handy link or reference)?

-Jeff


"Patrick" <cparker@noharvesting> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
Hi Jeff,
If using a database, you can create table with columns like these:

UserGroupID (or UserID) NOT NULL
ParentFormSecurityToken NULL
ChildConrolSecurityToken NULL
LinkToParentForm NULL

Then decorate each form and conrol with attribute that will tell you
wether the user has permission or not.
[HasPermissions(string SecurityToken)]
The attribute class will load the permissions for that user and check to
see if they have access.

But of course, if anyone else has a better way of doing it please chime
in
because I have to implement the same thing coming up real soon :)

--Patrick

"Jeff S" <A@B.COM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I'm implementing the Model View Presenter (MVP) pattern in a Windows
Forms application. There is a need to control which forms (views) are
accessible by specific users, and for some forms (views) to
enable/disable/hide controls for certain users or groups.

For sake of this question, please go with the model being a Person
object and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI
controls enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff



Feb 17 '06 #4
Hi, Jeff:
Microsoft has a MVC implementation (UIPAB), but this is not the solution
for your problem, but it can help on some other things.
I've made something like what you want to do. My suggestion is to create
your own controls, like a custom button, in a class that is derived from
standart button. This control should check something to see if it should be
enabled or not (make it customizable and extendable, using interfaces and
implementations to perform these checks)... This control SHOULD NOT access
database itself. It should call a security class, that will call a checking
class, that will call a DAL, that will access any storing place (a database,
in your case)...
There are some tricks to create controls, but nothing really painfull.
Make some google checking for that, or ask here again if you can't find
nothing usefull (I had the source code of a retail manufacturer, so it was
easy for me to know how to do custom controls)...

Good luck,
Ravi Wallau.

"Jeff S" <A@B.COM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I'm implementing the Model View Presenter (MVP) pattern in a Windows Forms
application. There is a need to control which forms (views) are accessible
by specific users, and for some forms (views) to enable/disable/hide
controls for certain users or groups.

For sake of this question, please go with the model being a Person object
and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI
controls enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff

Feb 17 '06 #5
You can create a base page class as well...
This class should NOT BE abstract in any case...

"Jeff S" <A@B.COM> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
I'm implementing the Model View Presenter (MVP) pattern in a Windows Forms
application. There is a need to control which forms (views) are accessible
by specific users, and for some forms (views) to enable/disable/hide
controls for certain users or groups.

For sake of this question, please go with the model being a Person object
and the view enabling users to modify Person properties.

1. What would be a good way to have the view appear with certain UI
controls enabled/disabled/hidden for different users?

2. Same question as #1, but for enabling/disabling entire forms for
different users.
Thanks for your time and consideration.

-Jeff

Feb 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3327
by: Earl Teigrob | last post by:
Background: When I create a ASP.NET control (User or custom), it often requires security to be set for certain functionality with the control. For example, a news release user control that is...
3
415
by: Earl Teigrob | last post by:
Background: When I create a ASP.NET control (User or custom), it often requires security to be set for certain functionality with the control. For example, a news release user control that is...
17
2257
by: stubbsie | last post by:
Hi, I have redesigned our official public government website in .net and it has taken me a few months to redo. I have been the sole designer of the website from its humble beginnning a few years...
1
1893
by: Jeremy S. | last post by:
..NET's code Access Security enables administrators to restrict the types of things that a .NET application can do on a local computer. For example, a ..NET Windows Forms application can be...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.