ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution
by Vince Varallo
6.4. Summary
Recall from Chapter 1 that when Mary was explaining her requirements, she asked for some type of security. Although she could only vaguely describe what she wanted and didn't understand security terminology, by implementing the pattern designed in this chapter you have now successfully met Mary's requirements for role-based security.
The key points to remember when adding a new page and applying security to it are as follows:
Add one or more records to the ENTMenuItem table. Usually, one record is added to the table for the two pages for data entry screens. The menu item navigates to the list page and from there the user can get to the data entry page.
Add one or more records to the ENTCapability table. Usually, one record is used for both the list page and the data entry page, but in some situations more than one capability will be associated with a page. Remember to add the id of the menu item on the capability record.
Set the correct AccessType on the ENTCapability record so it appears correctly on the Role screen. An enumeration maps to the AccessType field and can have three values: ReadOnlyEdit, ReadOnly, or Edit. You can add more if you want to customize the security for your own needs.
When creating a page, you must override the CapabilityNames method and return an array of strings that map to the capabilities for this page. Most of the time this method returns only one capability name.
If you have nonstandard input controls on a form or you need to implement ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access