我使用 Visual Studio 2010 开发了许多应用程序页面,并将它们部署在 SharePoint 2010 上。
所有页面均从 LayoutsPageBase
扩展。
目前,任何经过身份验证的用户都可以访问所有应用程序页面。但是,我想允许某些组/权限访问这些页面,并禁止其他组/权限访问。
我的问题:
如何将应用程序页面的权限设置为仅可由 SharePoint 级别和代码级别的某些组访问?
I have developed a number of application pages using visual studio 2010 and deployed them on SharePoint 2010.
All the pages have been extended from LayoutsPageBase
.
Currently all the application pages are accessible by any authenticated users. However I would like to allow certain groups/permission to access these pages and disallow access for other groups/permissions.
My question:
How can I set the permissions for application pages to be accessible only by certain groups on the SharePoint level and on the code level?
发布评论
评论(1)
从 LayoutsPageBase 覆盖这些属性的组合:
这些属性由 CheckRights 方法来授予或拒绝对应用程序页面的访问。
如果您需要比这些属性提供的更具体的内容,请设置 RightsCheckModes 为 None,然后编写您自己的代码,如果用户不应具有访问权限,则抛出以下异常:
遵循 LayoutsPageBase 类的约定,应通过您的重写来调用此自定义代码OnLoadComplete 或 OnPreInit事件。
Override a combination of these properties from LayoutsPageBase:
These properties are used by the CheckRights method to grant or deny access to an application page.
If you need something more specific than these properties offer, set RightsCheckModes to None and then write your own code that throws the following exception if the user should not have access:
Following the convention of the LayoutsPageBase class, this custom code should be called by your override of either the OnLoadComplete or OnPreInit events.