Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Make MVP Aware Of Security Model

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff S - 17 Feb 2006 05:36 GMT
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
Patrick - 17 Feb 2006 05:58 GMT
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

> 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
[quoted text clipped - 13 lines]
>
> -Jeff
Jeff S - 17 Feb 2006 06:15 GMT
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

> Hi Jeff,
>  If using a database, you can create table with columns like these:
[quoted text clipped - 32 lines]
>>
>> -Jeff
Patrick - 17 Feb 2006 06:31 GMT
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 :)

> Yes, I'll be persisting the user security info to a database. I'm
> particularly interested in integrating those settings with the MVP setup
[quoted text clipped - 43 lines]
>>>
>>> -Jeff
Ravi Ambros Wallau - 17 Feb 2006 12:41 GMT
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.

> 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
[quoted text clipped - 13 lines]
>
> -Jeff
Ravi Ambros Wallau - 17 Feb 2006 12:42 GMT
You can create a base page class as well...
This class should NOT BE abstract in any case...

> 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
[quoted text clipped - 13 lines]
>
> -Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.