1. 应用规则

1.1. 应用规则说明

在应用中的数据集上设置用于控制被授权用户所能看到的数据范围

1.1.1. 应用规则的定义

应用规则结构说明

字段 类型 描述
id LONG 应用规则的 id
name STRING 应用规则的标题
appId LONG 应用规则所属的应用id
options OBJECT 应用规则的配置信息
options.users OBJECT数组 应用规则作用的用户
options.organizations OBJECT数组 应用规则作用的用户组
options.position STRING 应用规则所在位置
position值说明
字段值 描述
PLATFORM 表示应用规则是平台方用户添加的
TENANT 表示应用规则是租户方用户添加的

1.2. 接口说明

1.2.1. 新增应用规则

请求URL

POST /api/v1/apps/{appId}/rules

请求参数

URL 参数

Request Body 参数
字段 类型 是否必须 描述
name STRING 应用规则的标题
options.users OBJECT数组 应用规则所选用户
options.organizations OBJECT数组 应用规则所选用户组
options.dataFilters OBJECT数组 应用规则过滤条件
options.dataFilters.datasetId NUMBER 过滤条件作用的数据集id
options.dataFilters.filter OBJECT 过滤信息
options.dataFilters.filter.where HE数组 行过滤条件

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 笔记结构说明

接口示例1

  1. 请求 POST /api/v1/apps/{appId}/rules
    {
    "name": "规则1",
    "users": [
     {
       "id": 1
     },
     {
       "id": 2
     }
    ],
    "organizations": [
     {
       "id": 1
     },
     {
       "id": 2
     }
    ],
    "dataFilters": [
     {
       "datasetId": 1,
       "filter": {
         "where": [
           {
             "kind": "function",
             "op": "and",
             "args": [
               {
                 "kind": "function",
                 "op": "<",
                 "args": [
                   {
                     "kind": "field",
                     "op": "id",
                     "type": "number"
                   },
                   {
                     "kind": "constant",
                     "op": 5,
                     "type": "number"
                   }
                 ]
               }
             ]
           }
         ]
       }
     }
    ]
    }
    
    返回
    {
    "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
    "code": 0,
    "msg": "success",
    "data": {
     "id": 5,
     "name": "规则1",
     "appId": 9,
     "options": {
       "users": [
         "1",
         "2"
       ],
       "organizations": [
         "1",
         "2"
       ],
       "position": "PLATFORM"
     },
     "createdBy": 1,
     "createdAt": "2020-05-28 15:14:43",
     "updatedBy": 1,
     "updatedAt": "2020-05-28 15:14:43",
     "dataFilters": [
       {
         "id": 6,
         "filter": {
           "columns": [],
           "where": [
             {
               "kind": "function",
               "op": "and",
               "args": [
                 {
                   "kind": "function",
                   "op": "<",
                   "args": [
                     {
                       "kind": "field",
                       "op": "id",
                       "type": "number"
                     },
                     {
                       "kind": "constant",
                       "op": 5,
                       "type": "number"
                     }
                   ]
                 }
               ]
             }
           ],
           "filterType": "DATASET",
           "position": "PLATFORM"
         },
         "datasetId": 1,
         "ruleId": 5,
         "effective": true
       }
     ]
    }
    }
    

1.2.2. 更新应用规则

请求URL

PUT /api/v1/apps/{appId}/rules/{rid}

请求参数

URL 参数

Request Body 参数
字段 类型 是否必须 描述
title STRING 应用规则的标题
connectionId NUMBER 应用规则所属的链接id
priority STRING 应用规则的权限级别
nodeType STRING 应用规则作用的节点类型
path STRING数组 nodeType不是CONNECTION时必须 应用规则作用的具体路径
options.filter.where HE数组 行过滤条件
users OBJECT数组 应用规则所选用户
organizations OBJECT数组 应用规则所选用户组

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 笔记结构说明

接口示例1

  1. 请求 PUT /api/v1/apps/{appId}/rules/{rid}
    {
    "id": 5,
    "name": "test",
    "appId": 9,
    "options": {
     "users": [
       "1"
     ],
     "position": "PLATFORM"
    },
    "dataFilters": [
     {
       "datasetId": 1,
       "filter": {
         "where": [
           {
             "kind": "function",
             "op": "and",
             "args": [
               {
                 "kind": "function",
                 "op": "<",
                 "args": [
                   {
                     "kind": "field",
                     "op": "id",
                     "type": "number"
                   },
                   {
                     "kind": "constant",
                     "op": 5,
                     "type": "number"
                   }
                 ]
               }
             ]
           }
         ]
       }
     }
    ],
    "users": [
     {
       "id": 1
     }
    ],
    "organizations": []
    }
    
    返回
    {
    "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
    "code": 0,
    "msg": "success",
    "data": {
     "id": 1,
     "title": "规则1",
     "connectionId": 8,
     "priority": "RO",
     "nodeType": "TABLE",
     "path": [
       "public",
       "A_IVT_MOVIE"
     ],
     "options": {
       "filter": {
         "columns": [],
         "where": [
           {
             "kind": "function",
             "op": "and",
             "args": [
               {
                 "kind": "function",
                 "op": "<",
                 "args": [
                   {
                     "kind": "field",
                     "op": "id",
                     "type": "number"
                   },
                   {
                     "kind": "constant",
                     "op": 5,
                     "type": "number"
                   }
                 ]
               }
             ]
           }
         ],
         "filterType": "CONNECTION"
       }
     },
     "createdBy": 1,
     "createdAt": "2020-05-28 12:21:31",
     "updatedBy": 1,
     "updatedAt": "2020-05-28 14:26:11",
     "visible": true,
     "users": [
       {
         "id": 1
       },
       {
         "id": 2
       }
     ],
     "organizations": [
       {
         "id": 1
       },
       {
         "id": 2
       }
     ],
     "editable": true,
     "delete": false
    }
    }
    

1.2.3. 根据ID获取应用规则

请求URL

GET /api/v1/apps/{appId}/rules/{rid}

请求参数

URL 参数

Request Body 参数

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 笔记结构说明

接口示例1

  1. 请求 GET /api/v1/apps/{appId}/rules/{rid}

返回

{
    "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
    "code": 0,
    "msg": "success",
    "data": {
        "id": 5,
        "name": "test",
        "appId": 9,
        "options": {
            "users": [
                "1"
            ],
            "position": "PLATFORM"
        },
        "createdBy": 1,
        "createdAt": "2020-05-28 15:14:43",
        "updatedBy": 1,
        "updatedAt": "2020-05-28 15:28:55"
    }
}

1.2.4. 根据ID删除应用规则

请求URL

DELETE /api/v1/apps/{appId}/rules/{rid}

请求参数

URL 参数

Request Body 参数

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值

接口示例1

  1. 请求 DELETE /apps/{appId}/rules/{rid}

返回

{
  "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 6,
    "name": "规则2",
    "appId": 9,
    "options": {
      "position": "PLATFORM"
    },
    "createdBy": 1,
    "createdAt": "2020-05-28 15:36:49",
    "updatedBy": 1,
    "updatedAt": "2020-05-28 15:36:49"
  }
}

1.2.5. 分页查询链接规则

请求URL

GET /api/v1/apps/{appId}/rules

请求参数

URL 参数
字段 类型 是否必须 说明
offset INTEGER 可选 分页偏移量,默认是0
limit INTEGER 可选 分页获取个数,默认是10
Request Body 参数

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 笔记结构说明

接口示例1

  1. 请求 GET /api/v1/apps/{appId}/rules

返回

{
  "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 5,
      "name": "test",
      "appId": 9,
      "options": {
        "users": [
          "1"
        ],
        "position": "PLATFORM"
      },
      "createdBy": 1,
      "createdAt": "2020-05-28 15:14:43",
      "updatedBy": 1,
      "updatedAt": "2020-05-28 15:40:14",
      "dataFilters": [
        {
          "id": 9,
          "filter": {
            "columns": [],
            "where": [
              {
                "op": "and",
                "args": [
                  {
                    "op": "<",
                    "args": [
                      {
                        "op": "id",
                        "kind": "field",
                        "type": "number"
                      },
                      {
                        "op": 5,
                        "kind": "constant",
                        "type": "number"
                      }
                    ],
                    "kind": "function"
                  }
                ],
                "kind": "function"
              }
            ],
            "position": "PLATFORM"
          },
          "datasetId": 1,
          "ruleId": 5
        }
      ],
      "users": [
        {
          "id": 1,
          "name": "test"
        }
      ]
    },
    {
      "id": 7,
      "name": "规则2",
      "appId": 9,
      "options": {
        "position": "PLATFORM"
      },
      "createdBy": 1,
      "createdAt": "2020-05-28 15:40:14",
      "updatedBy": 1,
      "updatedAt": "2020-05-28 15:40:14"
    }
  ],
  "totalHits": 2,
  "offset": 0
}

1.2.6. 预览权限生效后的数据

请求URL

POST /api/v1/apps/{appId}/rules/preview

请求参数

URL 参数
字段 类型 是否必须 描述
datasetId NUMBER 应用规则作用的数据集id
Request Body 参数
字段 类型 是否必须 描述
options.dataFilters OBJECT数组 应用规则过滤条件
options.dataFilters.datasetId NUMBER 过滤条件作用的数据集id
options.dataFilters.filter OBJECT 过滤信息
options.dataFilters.filter.where HE数组 行过滤条件

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 笔记结构说明

接口示例1

  1. 请求 POST /api/v1/apps/{appId}/rules/preview?datasetId=1
    {
    "dataFilters": [
     {
       "datasetId": 1,
       "filter": {
         "where": [
           {
             "kind": "function",
             "op": "and",
             "args": [
               {
                 "kind": "function",
                 "op": "<",
                 "args": [
                   {
                     "kind": "field",
                     "op": "id",
                     "type": "number"
                   },
                   {
                     "kind": "constant",
                     "op": 5,
                     "type": "number"
                   }
                 ]
               }
             ]
           }
         ]
       }
     }
    ]
    }
    
    返回
    {
    "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
    "code": 0,
    "msg": "success",
    "data": {
     "data": [
       [
         1,
         "星际穿越",
         "克里斯托弗·诺兰",
         "剧情",
         169,
         7.750885747373100000,
         416252,
         "马修·麦康纳",
         null,
         "2014-11-12",
         2014,
         11,
         12,
         "2014-11-12 08:30:00.000",
         null,
         "2014-11-12 16:30:00.000",
         true,
         {
           "msg": "audit-log/create-dataset-from-connection",
           "args": [
             "datalake-pg"
           ]
         },
         {
           "msg": "audit-log/create-dataset-from-connection",
           "args": [
             "datalake-pg"
           ]
         },
         "~!@#$%^&*(){}|”’<>?/.,;’"
       ],
       [
         2,
         "辛德勒的名单",
         "史蒂文·斯皮尔伯格",
         "剧情",
         195,
         7.970806439407170000,
         329749,
         "连姆·尼森",
         null,
         "1993-11-30",
         1993,
         11,
         30,
         "1993-11-30 09:00:06.000",
         null,
         "1993-11-30 17:00:06.000",
         false,
         {
           "msg": "audit-log/rename-column-label",
           "args": [
             "test20171016",
             "test   20171016"
           ]
         },
         {
           "msg": "audit-log/rename-column-label",
           "args": [
             "test20171016",
             "test   20171016"
           ]
         },
         "~!@#$%^&*(){}|”’<>?/.,;’"
       ],
       [
         3,
         "唐伯虎点秋香",
         "李力持",
         "喜剧",
         102,
         4.254042804241180000,
         260928,
         "周星驰",
         null,
         "1993-07-01",
         1993,
         7,
         1,
         "1993-07-01 08:20:09.000",
         null,
         "1993-07-01 16:20:09.000",
         true,
         {
           "address": {
             "country": "中国",
             "city": "江苏苏州",
             "street": "科技园路."
           },
           "isNonProfit": true,
           "name": "BeJson",
           "links": [
             {
               "name": "Google",
               "url": "http://www.google.com"
             },
             {
               "name": "Baidu",
               "url": "http://www.baidu.com"
             },
             {
               "name": "SoSo",
               "url": "http://www.SoSo.com"
             }
           ],
           "page": 88,
           "url": "http://www.bejson.com"
         },
         {
           "address": {
             "country": "中国",
             "city": "江苏苏州",
             "street": "科技园路."
           },
           "isNonProfit": true,
           "name": "BeJson",
           "links": [
             {
               "name": "Google",
               "url": "http://www.google.com"
             },
             {
               "name": "Baidu",
               "url": "http://www.baidu.com"
             },
             {
               "name": "SoSo",
               "url": "http://www.SoSo.com"
             }
           ],
           "page": 88,
           "url": "http://www.bejson.com"
         },
         "~!@#$%^&*(){}|”’<>?/.,;’"
       ],
       [
         4,
         "致命ID",
         "詹姆斯·曼高德",
         "剧情",
         90,
         9.574219468049710000,
         271970,
         "约翰·库萨克",
         null,
         "2003-04-25",
         2003,
         4,
         25,
         "2003-04-25 20:08:08.000",
         null,
         "2003-04-26 04:08:08.000",
         false,
         {
           "msg": "audit-log/create-chart",
           "args": [
             "wss-movie-join-weird"
           ]
         },
         {
           "msg": "audit-log/create-chart",
           "args": [
             "wss-movie-join-weird"
           ]
         },
         "~!@#$%^&*(){}|”’<>?/.,;’"
       ]
     ],
     "schema": [
       {
         "fieldName": "id",
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "id",
         "nativeType": "bigserial",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "zh_name",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "zh_name",
         "nativeType": "text",
         "suggestedTypes": [
           "string"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "director",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "director",
         "nativeType": "text",
         "suggestedTypes": [
           "string"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "prime_genre",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "prime_genre",
         "nativeType": "varchar",
         "suggestedTypes": [
           "string"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "runtime",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "runtime",
         "nativeType": "int2",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "rate_num",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "rate_num",
         "nativeType": "numeric",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "number",
         "visible": true,
         "originType": "number",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "votes",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "votes",
         "nativeType": "int8",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "stars",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "stars",
         "nativeType": "varchar",
         "suggestedTypes": [
           "string"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "tags",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "tags",
         "nativeType": "text",
         "suggestedTypes": [
           "string",
           "number"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "pubdate",
         "hsVersion": 1,
         "type": "date",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "pubdate",
         "nativeType": "date",
         "suggestedTypes": [
           "date",
           "string"
         ],
         "detectedType": "date",
         "visible": true,
         "originType": "date",
         "basicType": "date",
         "defaultAggrType": "year"
       },
       {
         "fieldName": "pubyear",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dateFormat": "yyyy",
           "dialectName": "PostgresqlDialect"
         },
         "label": "pubyear",
         "nativeType": "int4",
         "suggestedTypes": [
           "number",
           "string",
           "date"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "month",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "month",
         "nativeType": "int4",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "day",
         "hsVersion": 1,
         "type": "number",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "day",
         "nativeType": "int4",
         "suggestedTypes": [
           "number",
           "string"
         ],
         "detectedType": "integer",
         "visible": true,
         "originType": "integer",
         "basicType": "number",
         "defaultAggrType": "sum"
       },
       {
         "fieldName": "release_time",
         "hsVersion": 1,
         "type": "date",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "release_time",
         "nativeType": "timestamp",
         "suggestedTypes": [
           "date",
           "string"
         ],
         "detectedType": "time",
         "visible": true,
         "originType": "time",
         "basicType": "date",
         "defaultAggrType": "year"
       },
       {
         "fieldName": "happytime",
         "hsVersion": 1,
         "type": "unknown",
         "config": {},
         "label": "happytime",
         "nativeType": "time",
         "suggestedTypes": [
           "unknown"
         ],
         "detectedType": "unknown",
         "visible": true,
         "originType": "unknown",
         "basicType": "unknown",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "utc_time",
         "hsVersion": 1,
         "type": "date",
         "config": {
           "dialectName": "PostgresqlDialect"
         },
         "label": "utc_time",
         "nativeType": "timestamptz",
         "suggestedTypes": [
           "date",
           "string"
         ],
         "detectedType": "time",
         "visible": true,
         "originType": "time",
         "basicType": "date",
         "defaultAggrType": "year"
       },
       {
         "fieldName": "likeit",
         "hsVersion": 1,
         "type": "bool",
         "config": {},
         "label": "likeit",
         "nativeType": "bool",
         "suggestedTypes": [
           "bool",
           "string"
         ],
         "detectedType": "bool",
         "visible": true,
         "originType": "bool",
         "basicType": "bool",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "description",
         "hsVersion": 1,
         "type": "json",
         "config": {},
         "label": "description",
         "nativeType": "json",
         "suggestedTypes": [
           "json",
           "string"
         ],
         "detectedType": "json",
         "visible": true,
         "originType": "json",
         "basicType": "json",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "descrip_b",
         "hsVersion": 1,
         "type": "json",
         "config": {},
         "label": "descrip_b",
         "nativeType": "jsonb",
         "suggestedTypes": [
           "json",
           "string"
         ],
         "detectedType": "json",
         "visible": true,
         "originType": "json",
         "basicType": "json",
         "defaultAggrType": "count"
       },
       {
         "fieldName": "special",
         "hsVersion": 1,
         "type": "string",
         "config": {},
         "label": "special",
         "nativeType": "varchar",
         "suggestedTypes": [
           "string"
         ],
         "detectedType": "string",
         "visible": true,
         "originType": "string",
         "basicType": "string",
         "defaultAggrType": "count"
       }
     ],
     "pagable": true,
     "importSwitchable": true,
     "randomable": false
    }
    }
    

results matching ""

    No results matching ""

    应用参数 授权