If you can - create an NT group with all the Users that need to view it,
and just create a one-off assignment in reporting services to give browser
permissions for that group.
[quoted text, click to view] "Raghu" wrote:
> Hi,
>
> I have a requirement to add 100 users (Windows) as browsers to view a
> report. I was wondering if I can use some reportserver webservice
> method to automate these kinds of bulk permission assignments. Can you
> please help me which method comes close to assiging permissions to
> users, if it is possible at all.
>
> Thanks
>
You can use the following in VB.NET to set a permission on an object, its a
start
''' <summary>
''' Set security roles for the given item
''' </summary>
''' <param name="userOrGroupName"></param>
''' <param name="rolesIn"></param>
''' <param name="itemPath"></param>
''' <param name="keepCurrentPolicies"></param>
''' <returns></returns>
''' <remarks></remarks>
Private Shared Function SetSecurityPolicy(ByVal userOrGroupName As String,
ByVal rolesIn() As String, ByVal itemPath As String, ByVal
keepCurrentPolicies As Boolean, ByVal inheritFromParent As Boolean) As
Boolean
Try
Dim isRoot As Boolean = False
Dim inheritParent As Boolean = inheritFromParent
Dim policies() As ReportServer.Policy
Dim newPolicies() As ReportServer.Policy
Dim policy As New ReportServer.Policy()
Dim roles(rolesIn.Length - 1) As ReportServer.Role
For i As Integer = 0 To rolesIn.Length - 1
roles(i) = New ReportServer.Role()
roles(i).Name = rolesIn(i).Trim
Next
policy.Roles = roles
policy.GroupUserName = userOrGroupName
'While Not isRoot
' ' Once the root of the catalog is reached,
' ' stop applying policies
' If itemPath = "/" Then
' isRoot = True
' End If
policies = server.GetPolicies(itemPath, inheritParent)
' If the user selects not to keep inherited or current policy,
' empty the policy
If Not keepCurrentPolicies = True Then
policies = Nothing
End If
newPolicies = AddNewPolicy(policy, policies)
server.SetPolicies(itemPath, newPolicies)
itemPath = GetParentPath(itemPath)
'End While
debug.writeline("Successfully set policy for: " & itemPath)
Catch ex As Exception
Debug.WriteLine(ex.ToString)
debug.writeline(ex.Message)
End Try
End Function
''' <summary>
''' Takes the policy to add and applies it to the current set
''' of policies if applicable
''' </summary>
''' <param name="policyToAdd"></param>
''' <param name="policies"></param>
''' <returns></returns>
''' <remarks></remarks>
Private Shared Function AddNewPolicy(ByVal policyToAdd As
ReportServer.Policy, ByVal policies() As ReportServer.Policy) As
ReportServer.Policy()
If Not (policies Is Nothing) Then
Dim policy As ReportServer.Policy
For Each policy In policies
If policy.GroupUserName = policyToAdd.GroupUserName Then
Throw New Exception("The supplied User policy already exists for the item.")
End If
Next policy
Dim list As New System.Collections.ArrayList(policies)
list.Add(policyToAdd)
Return CType(list.ToArray(GetType(ReportServer.Policy)),
ReportServer.Policy())
Else
policies = New ReportServer.Policy(0) {}
policies(0) = policyToAdd
Return policies
End If
End Function 'AddNewPolicy