【问题标题】:Error subscription delivery in SSRS with custom security extension带有自定义安全扩展的 SSRS 中的订阅交付错误
【发布时间】:2013-10-16 18:57:08
【问题描述】:

我开发了一个自定义安全扩展程序,以便从我们的 Intranet 产品单点登录到报告服务。在我订阅之前,它就像一个魅力。

开发确实喜欢这里的建议: http://msdn.microsoft.com/en-us/library/ms155029.aspx

登录、上传和管理报告工作。每个用户都可以阅读和打开报告。 我们还实现了授权并覆盖了此处描述的功能: http://msdn.microsoft.com/en-us/library/ms152800.aspx

管理文件夹,报告也可以。

当我发布订阅以呈现报告以通过电子邮件发送报告时,系统会说用户没有足够的权限通过电子邮件发送报告。

notification!WindowsService_0!1674!10/09/2013-14:02:04:: i INFO: Handling subscription f70f374e-28fa-4ba2-8b0e-6633f1299ee9 to report Projekt Aufwand, owner: rausch, delivery extension: Report Server Email.
library!WindowsService_0!1674!10/09/2013-14:02:04:: i INFO: RenderForNewSession('/Projektverwaltung/Projekt Aufwand')
library!WindowsService_0!1674!10/09/2013-14:02:04:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: , Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: Die dem Benutzer 'rausch' erteilten Berechtigungen reichen zum Ausführen des Vorgangs nicht aus.;
library!WindowsService_0!1674!10/09/2013-14:02:04:: i INFO: Initializing EnableExecutionLogging to 'True'  as specified in Server system properties.
emailextension!WindowsService_0!1674!10/09/2013-14:02:04:: e ERROR: Error sending email. Exception: Microsoft.ReportingServices.Diagnostics.Utilities.RSException: Die dem Benutzer 'rausch' erteilten Berechtigungen reichen zum Ausführen des Vorgangs nicht aus. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: Die dem Benutzer 'rausch' erteilten Berechtigungen reichen zum Ausführen des Vorgangs nicht aus.
notification!WindowsService_0!1674!10/09/2013-14:02:04:: i INFO: Notification 6241f7f4-6225-44ea-b8ff-3654960ae218 completed.  Success: True, Status: Fehler beim Senden von E-Mail: Die dem Benutzer 'rausch' erteilten Berechtigungen reichen zum Ausführen des Vorgangs nicht aus.E-Mails werden nicht erneut gesendet., DeliveryExtension: Report Server Email, Report: Projekt Aufwand, Attempt 0

解决方法:我打开 ReportServer 数据库中的 subscriptions 表,并将 OwnerId UserId 替换为报表服务器管理员的 userId。然后订阅在管理员权限下运行并且可以正常工作。

有人知道我可以在哪里查看/检查以设置正确的权限吗?还是我必须在 CheckAccess 覆盖方法中添加一些代码?

部分代码:

  m_RptOperNames.Add(ReportOperation.CreateSubscription,
      OperationNames.OperCreateSubscription);
  m_RptOperNames.Add(ReportOperation.DeleteSubscription,
      OperationNames.OperDeleteSubscription);
  m_RptOperNames.Add(ReportOperation.ReadSubscription,
      OperationNames.OperReadSubscription);
  m_RptOperNames.Add(ReportOperation.UpdateSubscription,
      OperationNames.OperUpdateSubscription);
  m_RptOperNames.Add(ReportOperation.CreateAnySubscription,
      OperationNames.OperCreateAnySubscription);
  m_RptOperNames.Add(ReportOperation.DeleteAnySubscription,
      OperationNames.OperDeleteAnySubscription);
  m_RptOperNames.Add(ReportOperation.ReadAnySubscription,
      OperationNames.OperReadAnySubscription);
  m_RptOperNames.Add(ReportOperation.UpdateAnySubscription,
      OperationNames.OperUpdateAnySubscription);

这里我把整个c#类的代码搬过来调查一下:https://docs.google.com/file/d/0B02JCr49NYlUeDFVbWt2NVdpUmc/edit?usp=sharing

我没有看到任何执行或电子邮件订阅,但它不是参考代码的一部分。会这样吗?

编辑

看到这个:http://msdn.microsoft.com/en-us/library/bb283182.aspx 谁能告诉我通过电子邮件订阅订阅需要什么项目权限?然后我可以更深入地了解需要授予哪些项目。

更新

我仍然有这个问题,但我现在更聪明了:)。 事实上,电子邮件传递由 WindowsService Reportserver 使用的Microsoft.ReportingServices.Library.TimedSubscriptionHandler 处理。

如果您使用报告链接设置订阅,即使使用 CustomSecurity 扩展,订阅也只能工作! 添加报表使系统呈现报表。报表服务器在那里创建一个新会话,并且没有授予权限。我还不知道自定义安全扩展的继承是否在这里有效。

也许一些 SSRS / .NET 大师有一些技巧,在网上搜索了几个小时并没有给我任何解决方案。

解决方法:目前我在订阅上设置了一个触发器并将 OwnerId 替换为管理员 ID。

CREATE TRIGGER Subscription_overwrite_owner
   ON  dbo.Subscriptions
   AFTER INSERT, UPDATE
AS 
BEGIN
    -- replace the OwnerId with the uid from the admin account
    -- so the TimedSubscription runs with correct credentials
    UPDATE dbo.Subscriptions SET OwnerID = 'uuid admin from Users table'
END
GO

【问题讨论】:

    标签: c# reporting-services permissions customization


    【解决方案1】:

    我希望其他人找到答案,但几个月以来我没有继续调查问题所在。最后,获胜者是……

    不备注我使用示例项目来实现自定义安全扩展。

    我让它在我的环境中运行!

    1. 我确实使用示例 CustomSecurity 设置了一个安全扩展 项目
    2. 如果订阅包含附件(如呈现的报告),则一切正常,但订阅除外。
    3. 我后来发现它可以与管理员用户设置一起使用 在 rsreportserver.config (<Security><Configuration> 这是 从 SetConfiguration 设置加载。
    4. 示例项目向我们展示,我们将应用程序设置存储在 web.config!

    我确实在 web.config 中为我的自定义安全扩展存储了许多参数!

    在前端和渲染报告中一切正常。但是当涉及到带有附件的订阅时,我们会遇到权限错误...

    它适用于管理员,因为如果用户是管理员,CustomSecurity Sample 项目将授予访问权限!

    但是 ReportServicesService.exe 没有从 web.config 获取配置数据!

    这就是为什么我的所有 CheckAccess() 方法都无法检查其他安全设置的原因,因为我们在 web.config 中存储了例如如果我们用于获取自定义数据库的连接字符串。

    因此您现在可以重写代码并将所有配置数据从 web.config 移动到 rsreportserver.config 文件中。

    或者您也可以将您的 web.config 应用程序也添加到 /bin/ReportingServicesService.exe.config。

    就我而言,例如:

    <configuration>
      <configSections>
        <section name="RStrace" type="Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics" />
        <!-- custom authentication start -->
        <section name="CustomSecurity" requirePermission="false" />
        <!-- custom authentication end -->
      </configSections>
      <!-- custom authentication start -->
      <appSettings>
        <add key="log" value="d:\log"/>
        <add key="multi_company" value="true"/>
        <add key="default_domain" value="fqdn.domain.de"/>
        <add key="connection" value="database=ReportServer;server=(local);uid=sa;pwd=secret;" />
      </appSettings>
      <!-- custom authentication end -->
    

    这不是在哪里写的,我花了一段时间才弄清楚...

    希望对使用自定义表单身份验证和 SSRS 的每个人有所帮助。

    【讨论】:

    • 我们属于一个勇于创建自定义 SSRS 安全扩展的小众社会!非常感谢您发布此信息 - 网络上几乎没有关于 SSRS 自定义安全扩展的信息,更不用说关于计划报告的副作用了。
    • 很高兴看到我的帖子有助于其他遇到同样问题的人。
    猜你喜欢
    • 1970-01-01
    • 2016-07-24
    • 1970-01-01
    • 1970-01-01
    • 2019-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多