0

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

4

1 回答 1

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=mFKAjUff0MsqzygQAEwAQ#Uff0MsqzygQAEwDAQ#Vedone&0页面= =%22%24wa.policyroles%22&f=false

于 2013-06-04T16:00:44.970 回答