获取token

适用场景:token主要是为了⽤户在使⽤集成⻚⾯时作登录和权限验证

生成token - 图1

1.token生成方式

tokenkey

{
    "tokenType": "tokenKey",
    "key": "17745660173958a0ef32534f7cd0bc1a1cd32"
}

账号、密码

{
   "tokenType":"userPassword",
   "email":"admin",
   "password":"123456"
}

超管账号生成指定用户的token

{
   "tokenType":"tokenKey",
   "key":"165698812892820c9668733075039ef79ce12",
   "authUniqueId":"用户账号"  
}

注:如果不传就是⽤户名密码对应的⽤户本身,只有超管可以⽣成其它账号的鉴权token,别⼈只能⽣成⾃⼰的鉴权token。

2.token有效期

例:获取有效期为10年的token

{
    "tokenType": "tokenKey",
    "key": "17745660173958a0ef32534f7cd0bc1a1cd32"
    "expiryTime": 315360000
}

expiryTime的单位是秒,过期时间默认是一天(86400秒)。

3.token数据传参

filtermap和clientsetting的区别

filtermap是给表里的字段传参,所有用到这个表的报告、模型、大屏等都受参数限制,只显示参数里的数据;

clientsetting是给报告里的筛选器组件传一个默认值,其他的值还是能选择,不能做到真正的权限限制,且只对报告生效。

filtermap

地区筛选器A筛选"东北、西北"
{
    "tokenType": "userPassword",
    "email": "admin",
    "password": "123456", 
    "filterMap": {
        "【数据连接ID】": {                   
          "rule": "or",            
            "dataFilters": [{
                    "filterType": "listFilter",  
                    "selectType": "select", 
                    "tableName": "订单",          
                    "filter": {                      
                        "dim": {
                            "field": "地区",          
                            "dataType": "String"     
                        },                     
                        "select": [          
                             "东北", 
                             "西北"
                        ]
                    }
                }
            ]
        }
    }
}
地区筛选器A排除"东北"
{
    "tokenType": "userPassword",
    "email": "admin",
    "password": "123456", 
    "filterMap": {
        "【数据连接ID】": {
          "rule": "or",
            "dataFilters": [{
                    "filterType": "listFilter", 
                    "selectType": "unselect", 
                    "tableName": "订单",                   
                    "filter": {                      
                        "dim": {
                            "field": "地区", 
                            "dataType": "String"
                        },                 
                        "select": [
                             "东北" 
                        ]
                    }
                }
            ]
        }
    }
}

clientsetting

默认筛选报告中"东北"地区数据
{
    "tokenType": "userPassword",
    "email": "admin",
    "password": "123456",
    "clientSetting": {
        "integrate": { 
            "ignoreSearch": true, 
            "mode": "simple", 
             "toolbar": [
                "export"
            ], 
            "side": true, 
            "hidePublic": true, 
            "hidePrivate": true, 
            "hideTitle": true, 
            "hideScaleBar": true, 
             "tabColor": "red", 
            "hidePageBar": true, 
            "enableReportDetail": true, 
            "hideProgressBar": true, 
            "scale": 50, 
            "bottomBarPos": "top", 
            "disableGraphicJump": true, 
            "fit": true, 
            "defaults": { 
                "c-1-445-858-l8oadzv8": {
                    "selected": ["东北"],
                    "exclude": false
                }
            }
        }
    }
}