简体   繁体   English

mondrian 角色:按层级过滤并隐藏层级

[英]mondrian role: filter by hierarchy and hide hierarchy

I have a DB with different clients (table TD_CLIENTS), which shall have access to a mondrian Cube.我有一个具有不同客户端(表 TD_CLIENTS)的数据库,它可以访问 mondrian Cube。 Obviously, I want each client to be able to see only data of its own.显然,我希望每个客户端只能看到自己的数据。

I've accomplished this with a role per client (I have few clients, so this is an acceptable trade-off. Anyway, if anyone knows of a better way, I'll be SO happy to hear it):我已经通过每个客户的角色实现了这一点(我的客户很少,所以这是一个可以接受的权衡。无论如何,如果有人知道更好的方法,我会很高兴听到它):

<Schema name="my_schema" description="my  schema">
  <Dimension type="StandardDimension" visible="true" highCardinality="false" name="Clients">
    <Hierarchy name="Clients hierarchy" visible="true" hasAll="true">
      <Table name="td_clients" schema="public">
      </Table>
      <Level name="Client" visible="true" table="td_clients" column="client_id" nameColumn="client_name" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
      </Level>
    </Hierarchy>
  </Dimension>
  <Cube name="my cube" visible="true" cache="true" enabled="true">
    <Table name="my_facts_table" schema="public">
    </Table>
    <DimensionUsage source="Clients" name="Clients" visible="true" foreignKey="client_id" highCardinality="false">
    </DimensionUsage>
    <Measure name="my measure" column="amount" aggregator="sum" visible="true">
    </Measure>
  </Cube>
  <Role name="Client 2 test">
    <SchemaGrant access="all">
      <CubeGrant cube="my cube" access="all">
        <HierarchyGrant hierarchy="[Clients.Clients hierarchy]" topLevel="[Clients.Clients hierarchy].[Client]" bottomLevel="[Clients.Clients hierarchy].[Client]" rollupPolicy="partial" access="custom">
          <MemberGrant member="[Clients.Clients hierarchy].[A CERTAIN CLIENT]" access="all">
          </MemberGrant>
        </HierarchyGrant>
      </CubeGrant>
    </SchemaGrant>
  </Role>
</Schema>

But now, Since each logged-in user (associated with its client role) can see only one Client, I'd like to hide the Client hierarchy.但是现在,由于每个登录用户(与其客户端角色相关联)只能看到一个客户端,我想隐藏客户端层次结构。

How can I accomplish it?我怎样才能完成它?

Thank you and best regards!感谢你并致以真诚的问候!

You're close:你很接近:

Add a second HierarchyGrant to restrict its visibility, such as:添加第二个 HierarchyGrant 以限制其可见性,例如:

        <HierarchyGrant hierarchy="[Clients.Clients hierarchy]" rollupPolicy="partial" access="custom">
          <MemberGrant member="[Clients.Clients hierarchy].[A CERTAIN CLIENT]" access="all">
          </MemberGrant>
        </HierarchyGrant>
        <HierarchyGrant hierarchy="[Clients.Clients hierarchy]" rollupPolicy="partial" access="none">
        </HierarchyGrant>

Yet, keep in mind that tools like jpivot will not work unless you add a second (visible) dimension.但是,请记住,除非您添加第二个(可见)维度,否则 jpivot 之类的工具将无法使用。

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

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