日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CDA-分角色用户查询

發(fā)布時間:2023/12/16 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CDA-分角色用户查询 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

參數(shù)

pentaho獲取當(dāng)前角色:${[security:principalRoles]}
pentaho獲取當(dāng)前用戶:${[security:principalName]}


CDA示例-按角色查詢(sql jndi)

詳見和標(biāo)簽,控制只有administrator角色的用戶可以查詢到數(shù)據(jù)

<?xml version="1.0" encoding="utf-8"?> <CDADescriptor><!-- DataSource definition. Type controls what the datasource type is.The connection and query controls how the data is fetched. These valuesare specific to each access type--><DataSources><Connection id="1" type="sql.jndi"><Jndi>SampleData</Jndi></Connection></DataSources><!-- DataAccess object controls the query itselfAccess controls if the datasource can be seen from the outside or is tobe used from a Compound datasource only--><DataAccess id="1" connection="1" type="sql" access="public" cache="true" cacheDuration="3600"><Name>Sql Query on SampleData - Jndi</Name><Query><![CDATA[select o.YEAR_ID, o.STATUS, sum(o.TOTALPRICE) as price from orderfact owhere ${PRM_USER} like '%dministrator%'group by o.YEAR_ID, o.STATUS]]></Query><!-- All parameters are passed as string from the outside. Theirtype is defined here. If needed, a conversion pattern must be specifiedSupported types: String, Date, Integer, Numeric--><Parameters><Parameter default="${[security:principalRoles]}" name="PRM_USER" type="String"/></Parameters><!-- Columns block allow specifying name and CalculatedColumn the creation of newcolumns based on formulas--><Columns><Column idx="0"><Name>Year</Name></Column><CalculatedColumn><Name>PriceInK</Name><Formula>=[PRICE]/1000000</Formula></CalculatedColumn></Columns><!-- Settings block here overrides defaults and general settings --><Settings><Export type="csv" includeTotals="true"><Column idx="0" aggregator="None"/><Column idx="1" aggregator="Average"/></Export></Settings><!-- Output controls what is outputed and by what order. Defaults to everything --><Output indexes="1,0,2,3"/><Output id="2" indexes="0,1,3"/><Output id="3" indexes="1,0,2"/></DataAccess> </CDADescriptor>

##API調(diào)用示例:

1.admin查詢:

curl 'http://10.34.11.124:8080/pentaho/plugin/cda/api/doQuery?path=/home/suzy/QueryOverRoles.cda&dataAccessId=1&paramPRM_USER=%24%7B%5Bsecurity%3AprincipalRoles%5D%7D' -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='

結(jié)果:

{"metadata":[{"colName":"STATUS","colType":"String","colIndex":0},{"colName":"Year","colType":"Numeric","colIndex":1},{"colName":"PRICE","colType":"Numeric","colIndex":2},{"colName":"PriceInK","colType":"Numeric","colIndex":3}], "resultset":[["Shipped",2003,3573701.2500000014,3.5737012500000014],["Resolved",2003,28550.59,0.02855059],["Cancelled",2003,75132.15999999999,0.07513215999999999],["Shipped",2004,4750205.889999998,4.750205889999998],["Cancelled",2004,187195.13000000003,0.18719513000000003],["Resolved",2004,24078.610000000004,0.024078610000000004],["On Hold",2004,26260.210000000003,0.026260210000000003],["Shipped",2005,1513074.4600000002,1.5130744600000002],["Resolved",2005,98089.08000000002,0.09808908000000002],["On Hold",2005,152718.97999999995,0.15271897999999995],["Disputed",2005,72212.86,0.07221286],["In Process",2005,144729.96000000002,0.14472996000000002]], "queryInfo":{"totalRows":"12"}}

2.suzy查詢:

curl 'http://10.34.11.124:8080/pentaho/plugin/cda/api/doQuery?path=/home/suzy/QueryOverRoles.cda&dataAccessId=1&paramPRM_USER=%24%7B%5Bsecurity%3AprincipalRoles%5D%7D' -H 'Authorization: Basic c3V6eTpwYXNzd29yZA=='

結(jié)果:

{"metadata":[{"colName":"STATUS","colType":"String","colIndex":0},{"colName":"Year","colType":"Numeric","colIndex":1},{"colName":"PRICE","colType":"Numeric","colIndex":2},{"colName":"PriceInK","colType":"String","colIndex":3}], "resultset":[], "queryInfo":{"totalRows":"0"}}

總結(jié)

以上是生活随笔為你收集整理的CDA-分角色用户查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。