Forum Discussion
Insert user data through power bi report database to access reports
- Anonymous6 years ago
Hi d_gosbell,
Thank you for the suggestion. I have gone through each documentation as you mentioned and finally able to set the new user with role. It works fine for the 1st user but when again i tried to add another user with same role then got below error:
"A custom role cannot contain both system-level and non-system-level tasks in the same role definition. You must specify different roles for each category of tasks"
Below is my code which i used so far.
bool isPolicies = true; ReportingService2010 rs = new ReportingService2010(); rs.Url = "http://<domainName>/ReportServer/ReportService2010.asmx"; rs.Credentials = System.Net.CredentialCache.DefaultCredentials; var policies = rs.GetPolicies("/", out isPolicies); Role browserRole = new Role(); browserRole.Name = "System User"; Role[] r1 = new Role[1]; r1[0] = browserRole; Policy po = new Policy(); po.GroupUserName = @"<domain>\<username>"; po.Roles = r1; policies[0] = po; rs.SetPolicies("/", policies);One more things i wanted to add here is suppose i added one user with some role and when again i am going to add some other user then in getPolicies i am getting the previously inserted user and his role instead of BuiltIN/Administrator.
I tried to use my crednetials but in Policies getting the same user again.
Please provide some suggestion based on the credentials should get only those related policies.
Please suggest how do i fix this issue.
Thanks,
Vikash
Anonymous wrote:
Hi d_gosbell,
Thank you for the suggestion. It is working fine for me.
The only issue here is when the user which is added through policy. That user if trying to access Report server it is asking the user name and password credentials. For that if manually add the domain as Trusted Sites in Internet options and again refresh the url he can able to access the reports.
Can we bypass this authentication for the Powerbi User?
You can't do anything from the report server side to change this, it's a browser security setting. You will need to talk to your domain or network admins as they can set this via group policy so that you site is automatically added to either Intranet sites or Trusted sites for all users.
Can we delete user and assigned role using web service?
My guess is that you just call GetPolicies find the user in the array of policies, remove the items from the array that you no longer want then call the SetPolicies method passing in the array without the policies that are no longer required.
Hi d_gosbell,
Thank you for the suggestion. I have got the answer which i asked.
I am marking it as answer.