Reporting services Reporting services 2008 R2 web services api-如何管理安全权限?
我正在编写一个powershell脚本,以使用SSRS web服务将大量报表部署到SQL Server Reporting Services 2008 R2。我对这种方法很满意,创建一个新的部署文件夹并上传报告很容易。以下是显示文件夹创建的代码片段:Reporting services Reporting services 2008 R2 web services api-如何管理安全权限?,reporting-services,ssrs-2008,Reporting Services,Ssrs 2008,我正在编写一个powershell脚本,以使用SSRS web服务将大量报表部署到SQL Server Reporting Services 2008 R2。我对这种方法很满意,创建一个新的部署文件夹并上传报告很容易。以下是显示文件夹创建的代码片段: $reportServerUri = "http://{0}/ReportServer/ReportService2005.asmx" -f $reportServerName $proxy = New-WebServiceProxy -Ur
$reportServerUri = "http://{0}/ReportServer/ReportService2005.asmx" -f $reportServerName
$proxy = New-WebServiceProxy -Uri $reportServerUri -Namespace SSRS.ReportingService2005 -Credential $credential
#Dont currently set any properties so set empty array of properties
$propertyArray = @()
$warnings = $proxy.CreateFolder($folderName, $folderParent, $propertyArray)
然而,我也希望能够设置文件夹的权限,这是我有点卡住了。我想要复制的是,在web UI中,我将选择文件夹的安全选项,并针对角色添加用户\组
我原以为这可以通过createFolder调用上的propertyArray来完成,但我还没有在文档中找到任何信息(探测现有属性,看不到任何相关内容),我一直在寻找指导。所以就到了死胡同。我认为可能有一种特定的方法来管理这一级别的权限,但没有找到一种方法
我正在使用ReportingService2005Web服务,我知道也有2010Web服务,但我也没能在那里找到我想要的
有人知道我是如何使用web服务api(对于报表和共享数据源等其他对象,可能是一种一致的方法)向文件夹添加权限的吗?我认为这一定是可能的,因为web UI允许您这样做。这不是powershell问题,而是关于用于管理权限的api的问题
更新-下面是一段似乎可以完成这项工作的代码。我需要对此进行一些改进,因为看起来策略更新必须包含原始列表,所以我需要获取当前策略,将我的新策略添加到此列表中,并使用完整列表进行更新。但我以后会解决的
$Policies = $global:ssrsproxy.GetPolicies($ItemPath, [ref] $InheritsFromParent)
$PolicyAlreadyExists = $false
$Policies | Foreach-Object{ if ($_.GroupUserName -eq $GroupUserName)
{$PolicyAlreadyExists = $true} }
$Policies | Foreach-Object{ $_ | get-member }
if ($PolicyAlreadyExists){
"Policy already applied."
} else {
$Policy = New-Object SSRS.ReportingService2005.Policy
$Policy.GroupUserName = $GroupUserName
$Roles = @()
$Role = New-Object SSRS.ReportingService2005.Role
$Role.Name = $RoleName
$Roles += $Role
$Policy.Roles = $Roles
$global:ssrsproxy.SetPolicies($ItemPath, $Policy)
"Policy applied."
}
使用该方法。首先定义一个包含组/用户和所需角色的数组,然后将此数组与该项一起传递给SetPolicys