当分配给用户设计以Essbase 为数据源的报表(WA \FR)时,通常用户可以看到所有的元数据,一般通过设置essbase filter 中的meta_read 属性来实现对显示于元数据的控制。针对Hyperion Planning 用户Filter 中的None 与 Read 的属性值是通过Planning 端的权限刷新过来的。若分配用户对Planning 对一应的应用“访问服务”的权限,对于"规划者"及“交互”用户默认是只读的(可以修改Filter 来实现写操作权限),对于察看用户只能是只读权限。原则上我们可以通过手工复制filter 中的 read 项的值到meta_read 中来实现控制,但当刷新Planning权限时又会刷空meta_read 的值,每次都一个个加比较麻烦。
自动能刷新就好了!参照官方技术文档 发现 Maxl 中的 alter filter 、display filter row 、Spool on结合实现。脚本如下:
LogIn admin password on localhost;
spool on to "C:\Trace.txt";
display filter on database app.db;
spool off;
可以通过程序处理trace.txt 文件中的read 内容 生成 修改filter 中的meta_read 的内容。由于列宽问题可能会截断部分read 属性中的值。可以在上面脚本中增加set column_width n 来控制要显示的列宽,最长需要多少列宽不太好控制。放弃此想法。
我们知道essbase中关于安全控制的信息都回写入essbase.sec文件中,通过essbase.sec 文件找出filter 对应的read 的值或许是另外一个方法。
export security_filter to data_file "文件名" 可以输出 essbase.sec 文件内容到指定文件(文件内容包括服务器设置、数据库设置、用户、组、变量、filter 等信息)。filter 所在段以“**** Filters:” 开始,每个filter 结构如下:
fxuehong /*filter name*/
Application: AppTST
Database: Plan2
Default Access: Create
Active: TRUE
Number of rows: 2
None: @IDES("Account"),@IDES("Scenario"),@IDES("Version"),@IDES("Entity")
Read: @IDES("Entity_PS22002")
可通过windows脚本来生成修改filter 将filter 段中read 转换为 meta_read的批处理文件。(其中空格为char(9))。
转换为meta_read的脚本如下(另存为alter_filter.wsf文件):
<?XML version="1.0"?>
<!-- Create_Alter_Filter.wsf -->
Dim iPos
Dim bFilter, bApp
Dim strUsr, strRight, eStrLine, strFilterName, strFilter ,strDb
Dim objFSO, objFSOS, objFTO, objFTOT
Const strEssUsr = "Admin" Const strEssPsw = "chengdsc" Const strApp = "AppDEV" Const strEssHost = "10.18.32.60" Const ForReading = 1 Const strSecFileName = "C:\EssSecFile.txt" Const strMshFileName = "C:\Alter_Filter.msh" bFilter = False bApp = False Set bjFSO = WScript.CreateObject("Scripting.FileSystemObject") Set bjFTO = WScript.CreateObject("Scripting.FileSystemObject") Set bjFSOS = objFSO.OpenTextFile(strSecFileName, ForReading) Set bjFTOT = objFTO.CreateTextFile(strMshFileName, True)
objFTOT.WriteLine ("LogIn " & strEssUsr & " " & strEssPsw & " on " & strEssHost & ";")
Do While Not objFSOS.AtEndOfStream
eStrLine = objFSOS.Readline ''确认文件读取到Filters 位置 If InStr(eStrLine, "**** Filters:") > 0 Then bFilter = True End If
If bFilter Then If Len(Trim(eStrLine)) > 0 Then If Left(eStrLine, 2) = Chr(9) & "f" Then strFilterName = Trim(eStrLine) strUsr = Right(strFilterName, Len(strFilterName) - 2) strFilterName = "f" & strUsr End If ''确认应用名称 If InStr(eStrLine, "Application:") > 0 Then If InStr(eStrLine, strApp) > 0 Then bApp = True Else bApp = False End If End If If bApp Then if InStr(eStrLine,"Database:") > 0 then strDb = Right(eStrLine,Len(eStrLine)-30) End IF iPos = InStr(eStrLine, "Read:") If iPos > 0 Then iPos = Len(eStrLine) - iPos - 5 strRight = Right(eStrLine, iPos) strFilter = "Alter Filter " & strApp & "." & strDb & "." & strFilterName & " Add meta_read on " & "'" & strRight & "';" objFTOT.WriteLine (strFilter) End If End If End If End If
Loop
objFTOT.Close objFSOS.Close Set bjFTOT = Nothing Set bjFSOS = Nothing ]]>
Const strEssUsr = "Admin" Const strEssPsw = "chengdsc" Const strApp = "AppDEV" Const strEssHost = "10.18.32.60" Const ForReading = 1 Const strSecFileName = "C:\EssSecFile.txt" Const strMshFileName = "C:\Alter_Filter.msh" bFilter = False bApp = False Set bjFSO = WScript.CreateObject("Scripting.FileSystemObject") Set bjFTO = WScript.CreateObject("Scripting.FileSystemObject") Set bjFSOS = objFSO.OpenTextFile(strSecFileName, ForReading) Set bjFTOT = objFTO.CreateTextFile(strMshFileName, True)
objFTOT.WriteLine ("LogIn " & strEssUsr & " " & strEssPsw & " on " & strEssHost & ";")
Do While Not objFSOS.AtEndOfStream
eStrLine = objFSOS.Readline ''确认文件读取到Filters 位置 If InStr(eStrLine, "**** Filters:") > 0 Then bFilter = True End If
If bFilter Then If Len(Trim(eStrLine)) > 0 Then If Left(eStrLine, 2) = Chr(9) & "f" Then strFilterName = Trim(eStrLine) strUsr = Right(strFilterName, Len(strFilterName) - 2) strFilterName = "f" & strUsr End If ''确认应用名称 If InStr(eStrLine, "Application:") > 0 Then If InStr(eStrLine, strApp) > 0 Then bApp = True Else bApp = False End If End If If bApp Then if InStr(eStrLine,"Database:") > 0 then strDb = Right(eStrLine,Len(eStrLine)-30) End IF iPos = InStr(eStrLine, "Read:") If iPos > 0 Then iPos = Len(eStrLine) - iPos - 5 strRight = Right(eStrLine, iPos) strFilter = "Alter Filter " & strApp & "." & strDb & "." & strFilterName & " Add meta_read on " & "'" & strRight & "';" objFTOT.WriteLine (strFilter) End If End If End If End If
Loop
objFTOT.Close objFSOS.Close Set bjFTOT = Nothing Set bjFSOS = Nothing ]]>
运行essmsh C:\Alter_Filter.msh 既可完成刷新。
建立批处理文件内容包含:
1、调用CubeRefresh.cmd 刷新
2、调用包含export security_filter to data_file 的maxl 文件
3、调用alter_filter.wsf
4、调用Alter_Filter.msh
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7477027/viewspace-695779/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7477027/viewspace-695779/