如何使用SharePoint 2010中的power shell脚本在“拒绝所有”权限的Web应用程序中添加权限策略级别

时间:2013-06-04 11:23:32

标签: sharepoint-2010

如何使用power shell脚本在Web应用程序中添加权限策略级别,以及如何使用SharePoint 2010中的power shell脚本为“编辑项目”分配“全部拒绝”权限。!

1 个答案:

答案 0 :(得分:1)

拒绝所有权限,如果您选择权限级别为读取,则不允许任何人编辑该项目

Set-SPUser -Identity 'domain\name' -Web http://www.test.com -AddPermissionLevel Read

如果您想添加权限策略,这是脚本

$webapp = Get-SPWebApplication "http://www.test.com"
$name = "Deny all" $description = "Cannot edit items" $policy=$webapp.policyRoles.Add($name, $description) $policy.DenyRightMask="ViewFormPages,ViewVersions" //customize this according to your req. $policy.GrantRightMask="ViewListItems, OpenItems, Viewpages, ViewUsageData" $webapp.Update()

参考:http://books.google.com/books?id=rTBgroiWAesC&pg=PA251&lpg=PA251&dq=%22$wa.policyroles%22&source=bl&ots=mH5JbVRrYI&sig=hKMcVNqVgZyB5ZXvtb19-PaobCk&hl=en&sa=X&ei=mFKjUff0MsqzygGOuoDAAQ&ved=0CDgQ6AEwAQ#v=onepage&q=%22%24wa.policyroles%22&f=false