We have a legacy line of business web application. The application provides working platforms for various subscribers. We want to migrate the application to use SharePoint as its front-end and so to leverage SharePoint's site provisioning capability as well as other cool features such as customizable web part pages, survey/task list and so on.
As to security, the LOB has its own set of permissions, groups and users. All of them are stored in its custom database tables. SharePoint has its own concept of users, groups, permissions and permission levels. How to implement a security architecture to cover both of them? Before answering this question, we need to choose where to store all the LOB data. Should we store all of them in sharepoint lists/libraries? It is an easy decision because the LOB has a too complex relational database for SharePoint to handle. The CAML query and Search provided by SharePoint are more like a Meta data search facility, which are not very helpful for handling relational/transactional data. So, most of the transactional relational data should stay in the LOB database and the sharepoint security won't apply to those data. Therefore, we need to implement a security architecture to cover both sharepoint data and the LOB data. Essentially, the security architecture should allow to assign both sharepoint and custom permission to users. For example, We can say "User ABC" can "view web part" pages and "make purchase of product XYZ".
The overall architecture is as the following:
1: Use out-of-box ASP.NET form authentication's SQL membership and SQL role provider. (Notice, we choose not to create a custom security providers.)
2: Create database tables in the LOB database to map a ASP.NET form user to LOB permissions such as make "purchase of product XYZ".
3: Create custom sharepoint admin pages for managing ASP.NET users, roles and assigning both sharepoint permission levels and LOB permissions to them.
The code logic behind those admin pages is straightforward. For example, The logic flow to create an user group and assign permissions to the group is as the following:
1: Use ASP.NET role API to create an ASP.NET role. (ASP.NET role is basically a user group)
2: Use SharePoint object model API to map the ASP.NET role to a SharePoint User.
3: Assign the corresponding Permission Levels to the SharePoint User.
4: To assign LOB permissions to the ASP.NET role, use LINQ to SQL (the latest ASP.NET 3.5 dataaccess API) to update the LOB tables
The whole process is straightforward and simple as long as you have a clear understanding on ASP.NET form security and SharePoint Security.
Some of the key points that help to come to the design are:
1: ASP.NET role provider is essentially "Membership Group". It is not responsible for mapping a "Membership Group" to "Security Permissions". A Membership Group determines who are in the group. It does not know what permissions the group has.
2: SharePoint Permission Levels are "Permission Group".
3: LOB have its own permissions.
4: The security architecture is to Reuse the "Membership Group" feature from ASP.NET role provider and use custom coding to map the ASP.NET role to SharePoint permission levels and LOB permissions.
It is often confusing about different terminologies such as group, role, permission level and so on. Try to translate those terminologies into a common language such as Permission, Permission Group and Membership Group. Distinguishing Permission Group from Membership Group and understanding the process to assign Permissions/Permission Groups to Membership Group are very important.