Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : How to get use roles in embedded code or an external assembly



Bob
6/21/2005 5:34:03 PM
I need some suggestions on how to provide column level security within RS.
This there a function or Global/User that provides the roles the current user
belongs to? If the roles are accessible within the code script, I thought I
could pass it to an external assembly to perform validation check. I would
rather retrieve the value in the external assembly without the use of a
parameter. The assembly would return a boolean indicating if the role as
permission to see the value. The value would be set to "N/A" if they did not
have sufficient permissions.

Any suggestions would be greatly appreciated!!

Thank you,

Jan Pieter Posthuma
6/22/2005 1:55:07 AM
Hi,

You can use the Global variable User!UserID for this purpose. It contains
the actual domain\userID of the person. In your external assembly you can
look for the roles/groups the user belongs to.

Hope this would help you.

Jan Pieter Posthuma

[quoted text, click to view]
Bob
6/22/2005 2:35:03 AM
Hi,

Thank you, that helps. I have one additional question. In my external
assembly, how would I reference/retrieve the roles a person belongs to bases
on their UserID?

Bob

[quoted text, click to view]
Jan Pieter Posthuma
6/22/2005 8:25:06 AM
Hi,

The only way to do this is to call the webservice of SRS. Here you can
retrieve the system-wide policies by calling the GetSystemPolicies method.
This will return an array of policies. Just look in the list for the correct
GroupUserList and you can get his role.

<code>
public ReportService.Role[] GetUserRoles(string UserID)
{
ReportService.ReportingService rService =
new ReportService.ReportingService();
ReportService.Policy[] rsPolicies;

rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

rService.Url = "http://localhost/reportserver/ReportService.asmx";

rsPolicies = rService.GetSystemPolicies();

foreach (ReportService.Policy rsPolicy in rsPolicies)
{
if (rsPolicy.GroupUserName==UserID) { return rsPolicy.Roles; }
}

return null;
}
</code>

Hope this would help you further.

Jan Pieter Posthuma

[quoted text, click to view]
Bob
6/27/2005 3:19:03 AM
Thank you for your help. I'm sorry I have not been able to response sooner.
It works great!

Bob

[quoted text, click to view]
AddThis Social Bookmark Button