<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bob's SQL Reporting Services Blog : Model Security</title><link>http://blogs.msdn.com/bobmeyers/archive/tags/Model+Security/default.aspx</link><description>Tags: Model Security</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Considerations for a large report model</title><link>http://blogs.msdn.com/bobmeyers/archive/2009/04/27/considerations-for-a-large-report-model.aspx</link><pubDate>Mon, 27 Apr 2009 23:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9572331</guid><dc:creator>bobmeyers</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/9572331.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=9572331</wfw:commentRss><description>&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Customer report models that vary in size from a few to a few hundred entities. Little Northwind with its 10 or so entities comes in around 200K, but we've seen models a hundred times that size (over 20 MB). One of the key drivers of model size is the constraint that you cannot build a query across multiple models, so the tendency is to pull more and more data into the "main" model.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Given that, I thought I’d share a few tips that may help if you want to build, deploy, and use a large report model.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Configure the report server allow upload of large files.&lt;/B&gt; By default ASP.NET limits the file upload size to 4 MB. You will need to &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms159226.aspx"&gt;&lt;FONT face=Calibri size=3&gt;modify this setting&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; if your model exceeds the limit.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Consider removing the diagrams from the DSV&lt;/B&gt;. Typically the diagrams in a DSV account for ~20% of the uploaded model size. This information is only used by Model Designer, however, so removing it will not affect either the report server or a client like Report Builder. The DSV editor will not allow you to remove the default “&amp;lt;All Tables&amp;gt;” diagram, and if you do remove it, the editor will recreate it with a default layout the next time you open the file, so you will need to remove this diagram from the XML manually before publishing.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Define perspectives in the model&lt;/B&gt;. Perspectives allow users to self-select a convenient subset of the model at the time they design the report. This reduces download time (only the subset is retrieved by Report Builder) as well as clutter during the design experience. In extreme cases, you may want to &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/bobmeyers/archive/2007/02/27/requiring-report-builder-users-to-choose-a-perspective.aspx"&gt;&lt;FONT face=Calibri size=3&gt;require users to choose a perspective&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;. Note that perspectives are &lt;B style="mso-bidi-font-weight: normal"&gt;not &lt;/B&gt;a security feature. Also note that it is possible, though not particularly easy, to change the perspective used in a query after the query has been created.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Use model item security&lt;/B&gt;. This reduces the subset of the model available to specific users and groups, which in turn reduces the download time and visual clutter for those users. Note that&amp;nbsp;as of&amp;nbsp;SQL 2008&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms156307.aspx"&gt;&lt;FONT face=Calibri size=3&gt;report subscriptions are not supported&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; when using model item security.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;If you are using a large report model and have additional tips or questions, please &lt;A class="" title="contact me" href="http://blogs.msdn.com/bobmeyers/contact.aspx" mce_href="http://blogs.msdn.com/bobmeyers/contact.aspx"&gt;contact me&lt;/A&gt;. We'd love to get your feedback.&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9572331" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Configuration/default.aspx">Configuration</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Admin/default.aspx">Admin</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Security/default.aspx">Model Security</category></item><item><title>How to create a 'company' security filter for a hosted application</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/24/how-to-create-a-quot-company-quot-security-filter-for-a-hosted-application.aspx</link><pubDate>Sat, 25 Mar 2006 04:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:560200</guid><dc:creator>bobmeyers</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/560200.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=560200</wfw:commentRss><description>&lt;P&gt;&lt;FONT size=2 face=Arial&gt;Several customers have asked how to restrict data visibility in a report model for a hosted application, where every table has a "CompanyID" column, and every user that accesses the system is associated (via some other table) with exactly one company. The straightforward solution is to &lt;A href="http://blogs.msdn.com/bobmeyers/articles/Implementing_Data_Security_in_a_Report_Model.aspx" mce_href="http://blogs.msdn.com/bobmeyers/articles/Implementing_Data_Security_in_a_Report_Model.aspx"&gt;create a security filter&lt;/A&gt;&amp;nbsp;on each corresponding entity; the filter should check whether any rows exist in the user table entity where Users.CompanyID=This.CompanyID and UserTable.UserID=GETUSERID(). This will work, but the SQL that is generated for this filter may not be optimal.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;An alternative is to modify the DSV for the report model such that each table containing a CompanyID is really a named query of the form:&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;SELECT t.*, u.UserID FROM MyTable t, UserTable u WHERE t.CompanyID = u.CompanyID&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;Note that this derived table contains &lt;EM&gt;n &lt;/EM&gt;rows for each row in MyTable, where &lt;EM&gt;n &lt;/EM&gt;is the number of users associated with that row's company. To effectively fool the model, you will need to lie in the DSV and claim that the primary key of your derived table is composed of &lt;EM&gt;only &lt;/EM&gt;the key columns for MyTable.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;You must then create a security filter on the corresponding model entity for MyTable, which simply states UserID = GETUSERID(). If you create any other security filters for that entity, they MUST contain the same filter condition, in addition to any other conditions. No user should be given access to all the rows of that entity.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;This approach, while a bit of a hack, should result in much better SQL at runtime. &lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;Credits to my illustrious colleague &lt;/STRIKE&gt;&lt;A href="http://blogs.msdn.com/chrishays/" mce_href="http://blogs.msdn.com/chrishays/"&gt;&lt;STRIKE&gt;Chris Hays&lt;/STRIKE&gt;&lt;/A&gt;&lt;STRIKE&gt; for coming up with this.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;: The alternative proposed above does not work correctly in all cases because of an optimization we do in the SQL translation layer. Best practice is to stick with the "straightforward solution" described at the beginning of the post.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=560200" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Schema/default.aspx">Schema</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Security/default.aspx">Model Security</category></item><item><title>Article: Implementing Data Security in a Report Model</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/18/article-implementing-data-security-in-a-report-model.aspx</link><pubDate>Sat, 18 Mar 2006 21:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:554511</guid><dc:creator>bobmeyers</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/554511.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=554511</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I just posted&amp;nbsp;the first&amp;nbsp;&lt;A href="http://blogs.msdn.com/bobmeyers/articles/Implementing_Data_Security_in_a_Report_Model.aspx"&gt;article&lt;/A&gt; on my blog. Here's the abstract:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The report models introduced in SQL Server 2005 feature a number of ways to customize the data visible to different users and groups: perspectives, model item security, security filters, and opaque expressions. This article describes when and how&amp;nbsp;to use each of these features.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Comments and feedback welcome!&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=554511" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Admin/default.aspx">Admin</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Security/default.aspx">Model Security</category></item></channel></rss>