描述:saiku加载schema模型,选择维度或度量,动态组合要展示数据进行分析操作的工具。
话不多说,直接操作
1、用admin登陆saiku,点击A按钮,添加用户sa 如图:
2、设置用户名,密码,添加一个ROLE_SA
系统自带的角色信息: ROLE_ADMIN ROLE_USER 新增ROLE_SA
3、数据源设置,如图
注意:这块配置总共有两种实现方式,a. security.enabled=true和security.type=one2one
b. security.type=lookup和security.mapping=ROLE_ADMIN=ROLE_SA通过自己系统的账号角色映射到ROLE_ADMIN即可,这块就不演示了。如果是多个角色映射使用逗号即可,如下:
这块添加方式也有两种,第一种就是上面描述的,第二种,如图:
4、schema数据模型通过mdx语句控制即可
5、重启saiku服务器,并清除浏览器缓存,使用sa用户登陆即可
表数据:
整的schema模型:
<Schema metamodelVersion='4.0' name='t_tests' quoteSql='false'>
<PhysicalSchema>
<Table name='t_tests'/>
</PhysicalSchema>
<Cube caption='t_tests' name='t_tests'>
<Dimensions>
<Dimension caption='t_tests' key='id' name='t_tests' table='t_tests'>
<Attributes>
<Attribute caption='area' datatype='String' hasHierarchy='false' keyColumn='area' name='area' table='t_tests' visible='true'/>
<Attribute caption='country' datatype='String' hasHierarchy='false' keyColumn='country' name='country' table='t_tests' visible='true'/>
<Attribute caption='province' datatype='String' hasHierarchy='false' keyColumn='province' name='province' table='t_tests' visible='true'/>
<Attribute caption='city' datatype='String' hasHierarchy='false' keyColumn='city' name='city' table='t_tests' visible='true'/>
<Attribute caption='street' datatype='String' hasHierarchy='false' keyColumn='street' name='street' table='t_tests' visible='true'/>
<Attribute caption='name' datatype='String' hasHierarchy='true' keyColumn='name' name='name' table='t_tests' visible='true'/>
<Attribute caption='id' datatype='String' hasHierarchy='true' keyColumn='id' name='id' table='t_tests' visible='false'/>
</Attributes>
<Hierarchies>
<Hierarchy name='ts' allMemberName='All t_test'>
<Level attribute='country'/>
<Level attribute='province'/>
<Level attribute='city'/>
<Level attribute='street'/>
</Hierarchy>
</Hierarchies>
</Dimension>
</Dimensions>
<MeasureGroups>
<MeasureGroup name='t_tests' table='t_tests'>
<DimensionLinks>
<FactLink dimension='t_tests'/>
</DimensionLinks>
<Measures>
<Measure aggregator='sum' caption='age' column='age' datatype='Integer' formatString='#,###.00' name='age' table='t_tests'/>
</Measures>
</MeasureGroup>
</MeasureGroups>
</Cube>
<Role name='ROLE_SA'>
<SchemaGrant access='none'>
<CubeGrant cube='t_tests' access='all'>
<HierarchyGrant hierarchy='[t_tests].[ts]' access='custom' topLevel='[t_tests].[ts].[country]'>
<MemberGrant member='[t_tests].[ts].[中国].[陕西省]' access='all'/>
<MemberGrant member='[t_tests].[ts].[中国].[广东省].[广州市]' access='all'/>
</HierarchyGrant>
<!--<HierarchyGrant hierarchy="[Measures]" access="custom">
<MemberGrant member="[Measures].[age]" access="none"/>
</HierarchyGrant>-->
</CubeGrant>
</SchemaGrant>
</Role>
</Schema>
<MemberGrant member='[t_tests].[ts].[中国].[陕西省]' access='all'/>//控制该用户只能访问陕西省的数据
<MemberGrant member='[t_tests].[ts].[中国].[广东省].[广州市]' access='all'/>//控制该用户只能访问广州市的数据
saiku官方api下载网址:https://download.csdn.net/download/joe192/11609529