users[].dataRowScope 用于声明用户拥有的数据行权限,key 为 schema sid, value 为逗号分隔的 rowId 字符串。服务端会将这些记录同步到 usersYiaskCollections 中间表。Authorization: Bearer ********************{
"name": "storeOwner",
"title": "店长",
"users": [
{
"username": "zhangsan",
"nickname": "张三",
"email": "zhangsan@example.com",
"phone": "13800138001",
"password": "Password123!",
"dataRowScope": {
"dim_shops_default": "1",
"dwd_sales_detail_default": "10,11"
}
},
{
"username": "lisi",
"nickname": "李四",
"email": "lisi@example.com",
"phone": "13800138002",
"password": "Password123!",
"dataRowScope": {
"dwd_sales_detail_default": "2,3,4"
}
}
],
"permissions": {
"dim_shops_default": {
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
},
"columnPermissions": {
"view": [
"店铺ID",
"店铺名称"
]
}
},
"dwd_sales_detail_default": {
"columnPermissions": {
"view": null
},
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
}
}
}
}curl --location --request POST '/yiask_roles:updateOrCreateWithPermissions' \
--header 'X-SPACES: default' \
--header 'X-SPACES: {{space}}' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "storeOwner",
"title": "店长",
"users": [
{
"username": "zhangsan",
"nickname": "张三",
"email": "zhangsan@example.com",
"phone": "13800138001",
"password": "Password123!",
"dataRowScope": {
"dim_shops_default": "1",
"dwd_sales_detail_default": "10,11"
}
},
{
"username": "lisi",
"nickname": "李四",
"email": "lisi@example.com",
"phone": "13800138002",
"password": "Password123!",
"dataRowScope": {
"dwd_sales_detail_default": "2,3,4"
}
}
],
"permissions": {
"dim_shops_default": {
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
},
"columnPermissions": {
"view": [
"店铺ID",
"店铺名称"
]
}
},
"dwd_sales_detail_default": {
"columnPermissions": {
"view": null
},
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
}
}
}
}'{
"id": 1,
"name": "storeOwner",
"title": "店长",
"permissions": {
"dim_shops_default": {
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
},
"columnPermissions": {
"view": [
"店铺ID",
"店铺名称"
]
}
},
"dwd_sales_detail_default": {
"columnPermissions": {
"view": null
},
"rowPermissions": {
"allowUsers": {
"id": "{{ ctx.state.currentUser.id }}"
}
}
}
}
}