简体   繁体   English

SSRS Microsoft Reporting Services-由于用户权限而在报表创建过程中可能出现问题?

[英]SSRS Microsoft Reporting services - Possible problems during report creation due to user permissions?

I'm bumping my head with a strange issue that i'm having while generating reports, this is the scenario: 我在生成报告时遇到一个奇怪的问题,这是我的头,这是场景:

Created a report with two image inside and both are "external" links with two different parameters (img01 and img02 both text) that point to the image location on the SSRS database like this: 创建了一个内部带有两个图像的报告,它们都是带有两个不同参数(img01和img02均为文本)的“外部”链接,它们指向SSRS数据库上的图像位置,如下所示:

img01 - /images/img01.jpg img01-/images/img01.jpg
img02 - /documents/images/img02.jpg img02-/documents/images/img02.jpg

For the parameter img01 is definded a default value containing the "link", for the img02 the image path is required every time the report is executed. 为参数img01定义一个包含“链接”的默认值,对于img02,每次执行报告时都需要图像路径。

The idea is to invoke via a stored procedure (xp_cmdshell) the rs.exe command with a .rss config file for rendering the report as a .pdf, which is not a problem since I already have all the info on this part. 这个想法是通过存储过程(xp_cmdshell)调用带有.rss配置文件的rs.exe命令,以将报告呈现为.pdf,这不是问题,因为我已经掌握了这部分的所有信息。

What's happening... 发生了什么...

a. 一种。 if i execute the report via browser (ssrs interface so without automatic rendering) there are no problem both images are displayed and if I insert a wrong path for the img02 the small red "X" apperas 如果我通过浏览器(ssrs界面,因此没有自动渲染)执行报告,则不会显示两个图像,如果我为img02插入了错误的路径,则会显示红色的小“ X” apperas

b. if i take the string generated from the stored procedure that invoke the rs.exe command and i launch it in a CMD shell, the report is generated in a .pdf file, both images are displayed and if I insert a wrong path for the img02 the small red "X" apperas 如果我采用从调用rs.exe命令的存储过程中生成的字符串并将其在CMD Shell中启动,则报告将在.pdf文件中生成,同时显示两个图像,并且如果我为img02插入了错误的路径红色的小“ X” apperas

c. C。 i launch my stored procedure so now xp_cmdshell is in charge of running the rs.exe command, at this point the report is generated in a .pdf file but only the img01 (the one with the "default link") is visible; 我启动了存储过程,所以现在xp_cmdshell负责运行rs.exe命令,这时报告是在.pdf文件中生成的,但是只有img01(带有“默认链接”的那个)可见。 img02 either if the path is correct or it isn't I always have the red "X" img02无论路径正确还是不正确,我始终会有红色的“ X”

-- command used
set @cmd = 'rs.exe -i C:\try.rss -s http://url/reportserver -v img02=' + @img02 + ' -e Exec2005 -l 600'
insert @output (output) exec @rc = <database>..xp_cmdshell @cmd

[TO BE PRECISE the full sequence of point C is the following [精确点C的完整顺序如下
1- php page that connects to the database as admin (sa) 1- php页面,以管理员身份连接到数据库(sa)
2- call of the stored procedure (rs.exe) 2-调用存储过程(rs.exe)
3- report generation 3-报告生成
I omitted the php part since the outcome is the same either i run the stored from php or directly from management studio.] 我省略了php部分,因为无论是从php运行还是直接从Management Studio运行存储,结果都是相同的。]

I tried to change security permissions on "rs.exe" granting full access to "NT SERVICE\\MSSQLSERVER" but nothing changed. 我试图更改“ rs.exe”的安全权限,以授予对“ NT SERVICE \\ MSSQLSERVER”的完全访问权限,但未进行任何更改。

I tried to run xp_cmdshell with a "proxy_account" (not sure on this if i did all the thing in a correct way, i never played with this kind of things and all the "how-to" seems a little bit sketchy) but nothing changed. 我尝试使用“ proxy_account”运行xp_cmdshell(不确定是否以正确的方式完成了所有操作,我从没玩过这种事情,所有的“操作方法”似乎都有些粗略),但没有改变。

If anyone have any idea on the matter would be really appreciated :) (also if it's a potential security threat, at least i can start from somewhere). 如果有人对此事有任何想法,将不胜感激:)(同样,如果这是潜在的安全威胁,至少我可以从某个地方入手)。

In case you need more details or something in my description feels sketchy please tell me, I will try to be more complete. 如果您需要更多详细信息,或者我的描述中的内容有些粗略,请告诉我,我将尝试更加完整。

Regards, F. 问候,楼。

I would abandon the use of rs.exe, due to all the issues you are encountering. 由于您遇到的所有问题,我会放弃使用rs.exe。

Instead in Report Manager I would define a New Schedule (via Site Settings / Schedules). 取而代之的是,在报表管理器中,我将定义一个新计划(通过“站点设置” /“计划”)。

Then I would add a Subscription for the report which renders in PDF. 然后,我将为以PDF格式呈现的报告添加订阅。 I would attach that Subscription to the New Schedule defined previously. 我会将该订阅附加到先前定义的新计划中。

Then I would change the stored procedure to call the SSRS procedure AddEvent, eg 然后,我将更改存储过程以调用SSRS过程AddEvent,例如

-- Execute a Shared Schedule: DECLARE @ScheduleID UNIQUEIDENTIFIER DECLARE @ScheduleName AS VARCHAR(128) = 'My SharedSchedule Name' -- Get the Schedule identifier SET @ScheduleID = (SELECT ScheduleID FROM ReportServer.dbo.SCHEDULE WHERE NAME = @ScheduleName) -- pass the Schedule identifier to the Event insert procedure EXEC ReportServer.dbo.AddEvent @EventType='SharedSchedule', @EventData=@ScheduleID

Ref: 参考:

http://www.sqlblog.nl/2013/10/dynamic-refresh-ssrs-cache-using-sql/ http://www.sqlblog.nl/2013/10/dynamic-refresh-ssrs-cache-using-sql/

I finally figured out which was the issue. 我终于弄清楚了这是问题所在。 All the images that were not displayed in the report and passed via "parameter" where dynamically generated using an external source and then uploaded to the ssrs "Catalog" table via a stored procedure. 所有未在报表中显示并通过“参数”传递的图像,这些图像是使用外部源动态生成的,然后通过存储过程上传到ssrs “目录”表中。 When I parametrize all the information for uploading the image to the ssrs database, I also need to specify a field that defines the security properties for the single file. 当我参数化用于将图像上传到ssrs数据库的所有信息时,我还需要指定一个字段,该字段定义单个文件的安全性属性。 So if, very basically and shame on me, the folder is browsable/editable by (eg) admin and guest but the file security is set only for admin then the image will not be displayed in the report. 因此,如果从根本上来说让我感到羞耻,则该文件夹可由(例如)管理员和来宾浏览/编辑,但仅为管理员设置了文件安全性,则该图像将不会显示在报告中。 The column that refers to this property in the ssrs database is "PolicyId" contained in the "Catalog" table of the reporting database. ssrs数据库中引用此属性的列是报告数据库的“目录”表中包含的“ PolicyId”

In the end what I did, was change the security properties of an existing file with the admin and guest permissions copy the numeric code generated in the "PolicyId" column and every time the stored procedure that creates this image runs I attach this code to the field, preserving the security policies for the file. 最后,我所做的是使用admin和guest权限更改了现有文件的安全属性,复制了“ PolicyId”列中生成的数字代码,并且每次运行创建此映像的存储过程时,我都会将此代码附加到字段,保留文件的安全策略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM