title: Control Report Permission Based on Parameters in Reporting Services
body: <p>Assume we have a report called SalesSummary for a large department. This department has many smaller teams for each product. People should be able to see information about their own product, not other teams' products. We also have one domain group for each of these teams.</p>
  
  <p>Copying SalesSummary report for each team and setting the permission is not the best option since we have many products.  I was thinking to use a code similar to below on RS, but it doesn't work. Apparently, System.Security.Principal.WindowsPrincipal is disabled by default on RS.</p>
  
  <pre><code>Public Function isPermitted() As Boolean
     Dim Principal As New System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent())
     If (Principal.IsInRole("group_prod")) Then
        Return true
     Else
        Return false
     End If
  End Function
  </code></pre>
  
  <p>I also thought I can send the userID from RS to SQL server, and inside my SP I can use a code similar to below to query active directory. This also doesn't work due to security restriction. </p>
  
  <pre><code>SELECT
  * 
  FROM OPENQUERY(ADSI,'SELECT cn, ADsPath FROM ''LDAP://DC=Fabricam,DC=com'' WHERE objectCategory=''group''')
  </code></pre>
  
  <p>Is there any easier way to achieve this goal? </p>
  
  <p>Thanks for the help! </p>