All,
I'm wondering if there are any methods to set the permissions for a specific user on a specific report within SQL Server Reporting Services.
I got how to get permission from them programmatically, but not how to set them but the user interface..
Please apologize me if there was a similar thread in the recent past; I tried to find it out, I didn't succeed.
Thanks a lot in advance for your timely response (as usual deadlines are by "yesterday").
-G

Setting permissions programmatically
Mark Greene
Dim rs As New ReportingService2005()
rs.Credentials = New NetworkCredential("username", "password")
rs.Url = "http://localhost/reportserver/ReportingService2005.asmx"
Dim txtRoleName As String = "Browser"
Gasys
A little of more help with this
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.policy.groupusername.aspx
flynhigh
In other words... if i have username = AA1111. I am trying to understand what i need to do to make it work.
Thanks for your help
Ryan
Spamsickle
Ryan,
I am using ASP.NET for this coding and the authentication is "Windows".
This code i did for just for learning purpose.
I am creating "MyRptService" in the Page_load event
Also I set a referance to the webservice in the project.
Below is the code
private
void Page_Load(object sender, System.EventArgs e){
// Put user code to initialize the page hereSecurityScopeEnum SSEnum=
new SecurityScopeEnum();MyRptService.Credentials =
new NetworkCredential("dinesh", "password", "domain");}
I just put a button for click and 3 text boxes for ObjectName,UserName and RoleName respectively.
See the code.
private
void btnAddUser_Click(object sender, System.EventArgs e){
Policy[] MyPolicyArr =
new Policy[1];Policy MyPolicy =
new Policy();Role[] MyRoles=
new Role[1];Role MyRole=
new Role();MyRole.Name=txtRoleName.Text;
MyPolicy.GroupUserName =@ txtUserName.Text;
MyRoles[0]=MyRole ;
MyPolicy.Roles=MyRoles;
MyPolicyArr[0]=MyPolicy;
MyRptService.SetPolicies(txtObjectName.Text, MyPolicyArr);
}
I put
txtRoleName.Text="Browser"
txtUserName.Text="Domain\UserName"
txtObjectName.Text="\ObjectName" (Provided the object was a report saved in the home folder.)
Hope this would be useful
Thanks
Dinesh
bstaz
SnowFiveOfNine
Did you do somethin like this:
Dim MyRptService As ReportingService2005
before you did this:
MyRptService.Credentials = new NetworkCredential("dinesh", "password", "domain");
KjellSJ
i am thinking it is more like this (VB)
Dim rs As ReportingService2005
Dim Item As String = "/"
Dim Policies() As Policy
Policies(0) = New Policy
Policies(0).GroupUserName = TxtUser.ToString
Policies(0).Roles = New Role(0) {}
Policies(0).Roles(0) = New Role
Policies(0).Roles(0).Name = "Browser"
Policies(0).Roles(0).Description = "May view folders and reports."
rs.SetPolicies(Item, Policies)
Neil Munro
But what if you are not using windows authenication. i am trying to get this to work with forms authenication. Do i need to anything different
when you do this:
MyRptService.Credentials = new NetworkCredential("dinesh", "password", "domain");
are you keeping these Network Credential constant as you add diffrent users as browsers, or are you changing this with each one
Miriyala
ps.GroupUserName =
@"se\myuser"; Policy[] psarrays = new Policy[1]{ps};rs.SetPolicies(
"/report1", psarrays);Please mark the correct posts as answers
Sirisuda
reference the ReportService2005.asmx
and use the following method
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.setpolicies(SQL.90).aspx
with the policy object
http://msdn2.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.policy.aspx
There are no examples there but you will find out with a little of investigations, this is the starting point
Kalexin
Dinesh,
Are you doing this VIsual Studio
We are using Forms Authencation not windows authenication. Where do you define MyRptService
Also, I want my item to be the Home Folder.
THanks for you help
Viorel.
Hi ,
This code is working
Policy[] MyPolicyArr =
new Policy[1];Policy MyPolicy =
new Policy();Role[] MyRoles=
new Role[1];Role MyRole=
new Role();MyRole.Name="Browser";
MyPolicy.GroupUserName =@"Domain\User";
MyRoles[0]=MyRole ;
MyPolicy.Roles=MyRoles;
MyPolicyArr[0]=MyPolicy;
MyRptService.SetPolicies("/ReportName", MyPolicyArr);
Regards
Dinesh