Sql Server Analysis Services 2008 使用 MDX 表达式的动态维度安全性

发布于 2024-07-30 17:14:42 字数 1138 浏览 3 评论 0原文

我的仓库中的一些维度表:

DML
Site
    Id      bigint
    Name    nvarchar(256)
    Primary key (Id)

DATA
SiteId    Name
2         Site 2
3         Site A

DML
UserSite
    Username    nvarchar(256)
    SiteId      bigint
    Primary key (Username, SiteId)
    Foreign key (SiteId) referrences Site(Id)

DATA
Username    SiteId
EMSUser1    2
EMSUser1    3
EMSUser2    3

我的SSAS项目: 我在 BIDS 项目的一个维度中使用了这两个维度表,这是使用维度向导创建的。 用户名与 SSAS 服务器上的两个本地 Windows 用户帐户相关,它们是本地 Windows 的成员 组报告浏览器。 我已在 BIDS 中为该组创建了一个角色,并将 MDX 表达式添加到维度数据选项卡 对于用户名属性的AllowedSet 框中的此维度:

STRTOMEMBER("[UserSiteSite].[Username].["+Trim(Mid( UserName, InStr(1, UserName, "\")+ 1,128))+"]")

此维度用于已全部处理和部署的多维数据集中。 然后我就有了一份基于该多维数据集的 SSRS 报告。

我的意图: 我想做的是获取当前浏览 SSRS 的登录用户并删除返回的字符串的“\”部分 有效地将结果过滤到用户名有记录的网站。

因此,对于 EMSUser1,我应该看到两个站点的记录,但它似乎只允许第一个站点(ID 为 2 的“站点 2”) 即使事实表中存在该站点的记录,也没有“站点 A”的迹象。

我一直在仔细阅读 Analysis Services 2008 Unleashed 以及分步指南和博客等。 我只是不太了解实现我的目标的内部运作方式。

我究竟做错了什么?

Some dimension tables in my warehouse:

DML
Site
    Id      bigint
    Name    nvarchar(256)
    Primary key (Id)

DATA
SiteId    Name
2         Site 2
3         Site A

DML
UserSite
    Username    nvarchar(256)
    SiteId      bigint
    Primary key (Username, SiteId)
    Foreign key (SiteId) referrences Site(Id)

DATA
Username    SiteId
EMSUser1    2
EMSUser1    3
EMSUser2    3

My SSAS Project:
I have used these two dimension tables in one dimension in a BIDS project, created using the dimension wizard.
The usernames relate to two local windows user accounts on the SSAS Server, they are members of a local windows
group ReportBrowsers. I have created a Role for that group in BIDS and added an MDX Expression to the dimension Data tab
for this dimension in the AllowedSet box for the Username attribute:

STRTOMEMBER("[UserSiteSite].[Username].["+Trim(Mid( UserName, InStr(1, UserName, "\")+ 1,128))+"]")

This dimension is used in a cube that's all processed and deployed. I then have an SSRS Report based on that cube.

My intention:
What I'm trying to do is take the logged in user currently browsing SSRS and remove the "<domain>\" part of the string returned
effectively filtering the results to just the sites that username has a record for.

So for EMSUser1 I should see records for both sites, but it appears to be allowing the first one only ("Site 2" with Id 2)
There's no sign of "Site A" even though records exist for that site in the fact table.

I've been trawling through Analysis Services 2008 unleashed and the step by step book and all over blogs etc.
I just can't quite grok the internal workings to achieve my goal.

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

入怼 2024-08-06 17:14:43

好吧,已经有一段时间了。 即使现在我也没有完整的答案,但我确实得到了其他一些帮助,这使我找到了解决方案。 详细信息可以在此处找到

有很多方法可以解决这种情况。 我觉得可能还有一个更适合我的,但我至少有一些有用的东西。 基本上创建一个带有静态类和函数的单独的类库,使其自己连接到数据库并选择允许的集合。 如果您引用 Microsoft.AnalysisServices
和 Microsoft.AnalysisServices.AdomdServer 命名空间,您可以返回“Set”对象。 然后,您可以在角色对象维度数据高级选项卡中调用此函数:

MyAssembly.MyMethod(UserName)

Well it's been some time now. I don't have the complete answer even now but I did get some help else where that has lead me to a solution. The details can be found here.

There are a lot of ways to solve this kind of scenario. I feel there may still be a better one for me, but I have something that at least works. Basically create a seperate class library with a static class and function that makes it's own connection to the database and selects out the allowed set. If you reference the Microsoft.AnalysisServices
and Microsoft.AnalysisServices.AdomdServer namespaces you can return a 'Set' object. You can then call this function in the Role objects Dimension data advance tab:

MyAssembly.MyMethod(UserName)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文