sharepoint - 以编程方式打破权限级别继承

标签 sharepoint sharepoint-2010

我想创建一个具有自己的自定义权限级别的子网站。目前,当我访问权限级别屏幕 http://servername/subsite1/_layouts/role.aspx 时我看到了所有权限级别,但这些是来自 rootweb 的权限级别。如何打破这里的继承并添加我自己的自定义权限级别?

目的是因为该角色在该站点之外没有用处,因此我不想将其放在根目录中。

这个问题与这里提出的问题相同:http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/32ad2700-8009-4636-880e-07acfca98a06但 Shah Mehul 回复说可以通过编程来完成。难道他弄错了?我已阅读 SPWeb.BreakRoleInheritance(Boolean, Boolean) 处的参数说明但它们没有描述权限级别。

最佳答案

您仍然可以在 sharepoint 2010 中中断权限级别继承,尽管只能通过编程方式进行(引用:http://technet.microsoft.com/en-us/library/ff607713.aspx,子网站的权限部分)

要以编程方式中断它,您可以使用 SPRoleDefinitionCollection.BreakInheritance 方法 ( http://msdn.microsoft.com/en-us/library/ee547386.aspx )

Powershell 示例:

$web = Get-SPWeb "your site URL"
$web.RoleDefinitions.Delete("Some Custom Perm Level") # will not work, because perm levels are inherited
$web.RoleDefinitions.BreakInheritance(true,true)
$web.RoleDefinitions.Delete("Some Custom Perm Level") #will work

关于sharepoint - 以编程方式打破权限级别继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7038444/

相关文章:

sharepoint - 如何将列表项设置为只读

azure - 使用 Azure 功能备份 Sharepoint Online

c# - 了解 ClientContext.Load 的参数

javascript - 获取/捕获 promise 中的响应状态

powershell - 如何获取 CSV 中标题的值

c# - "Due to heavy load, the latest workflow operation has been queued"--> 如何查看队列?

sharepoint - 对象模型权限

sharepoint - SharePoint 中的列表和内容类型有什么区别?

visual-studio-2010 - 如何为 SharePoint 2010 Visual Studio 解决方案设置持续部署?

sharepoint-2010 - SharePoint 2010 开发问题