I'm trying to restrict access to certain pages of a SharePoint Web Application based upon a user's membership in certain SharePoint groups (restricting access to specific pages and functions, while otherwise granting a user greater rights via SharePoint RoleDefinitions and groups)
I plan to assume that proper groups exist and that appropriate RoleDefinitions are applied to the user's groups, so when a particular page is requested and caught (perhaps on the HttpApplication.AuthorizeRequest event [?]) I am looking to either redirect them to the site/web access denied page, return a simple 401, or something similar, if they are not in a particular SharePoint group.
If I can actually go in and check for particular RoleDefinitions on the user's SharePoint group(s), that would be even better.
Once I get the user's principal (with HttpApplication.Context.User.Identity
??) in the HttpModule, how do I go about checking what Groups (or Roles) they are associated with in SharePoint? Which assemblies, functions, etc would I have to utilize to get this info? Also is this significantly more complicated if they are granted the SharePoint Permissions through an AD group (i.e. Their User is in an AD group, which is a member of a SharePoint Group, which has one or more RoleDefinitions applied)?
There would be a finite number of pages to restrict and a finite number of SharePoint Groups (or possibly RoleDefinitions), but an unknown number of users.