Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
4786d23d
提交
4786d23d
authored
12月 27, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 数据集页面支持行权限
上级
1ff6f135
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
102 行增加
和
22 行删除
+102
-22
RowPermissionsController.java
.../io/dataease/plugins/server/RowPermissionsController.java
+38
-4
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+19
-11
dataset.js
frontend/src/api/dataset/dataset.js
+1
-1
index.vue
frontend/src/components/AsyncComponent/index.vue
+5
-0
en.js
frontend/src/lang/en.js
+7
-1
tw.js
frontend/src/lang/tw.js
+7
-1
zh.js
frontend/src/lang/zh.js
+7
-1
ViewTable.vue
frontend/src/views/dataset/data/ViewTable.vue
+13
-2
PluginCom.vue
frontend/src/views/system/plugin/PluginCom.vue
+5
-1
没有找到文件。
backend/src/main/java/io/dataease/plugins/server/RowPermissionsController.java
浏览文件 @
4786d23d
package
io
.
dataease
.
plugins
.
server
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.plugins.common.entity.XpackConditionEntity
;
import
io.dataease.plugins.common.entity.XpackGridRequest
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO
;
import
io.dataease.plugins.xpack.auth.dto.request.DatasetRowPermissions
;
import
io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO
;
import
io.dataease.plugins.xpack.auth.service.RowPermissionService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"plugin/dataset/rowPermissions"
)
public
class
RowPermissionsController
{
...
...
@@ -24,16 +29,45 @@ public class RowPermissionsController {
@ApiOperation
(
"查询"
)
@PostMapping
(
"/list"
)
public
List
<
DataSetRowPermissionsDTO
>
rowPermissions
(
@RequestBody
XpackSysAuthDetail
DTO
request
)
{
public
List
<
DataSetRowPermissionsDTO
>
rowPermissions
(
@RequestBody
DataSetRowPermissions
DTO
request
)
{
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
return
rowPermissionService
.
searchRowPermissions
(
request
);
}
@ApiOperation
(
"删除"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
void
dataSetRowPermissionInfo
(
@PathVariable
String
id
)
{
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
rowPermissionService
.
delete
(
id
);
}
@ApiOperation
(
"分页查询"
)
@PostMapping
(
"/pageList/{datasetId}/{goPage}/{pageSize}"
)
public
Pager
<
List
<
DataSetRowPermissionsDTO
>>
rowPermissions
(
@PathVariable
String
datasetId
,
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
XpackGridRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
List
<
XpackConditionEntity
>
conditionEntities
=
request
.
getConditions
()
==
null
?
new
ArrayList
<>()
:
request
.
getConditions
();
XpackConditionEntity
entity
=
new
XpackConditionEntity
();
entity
.
setField
(
"dataset_row_permissions.dataset_id"
);
entity
.
setOperator
(
"eq"
);
entity
.
setValue
(
datasetId
);
conditionEntities
.
add
(
entity
);
request
.
setConditions
(
conditionEntities
);
return
PageUtils
.
setPageInfo
(
page
,
rowPermissionService
.
queryRowPermissions
(
request
));
}
@ApiOperation
(
"有权限的对象"
)
@PostMapping
(
"/authObjs"
)
public
List
<
Object
>
authObjs
(
@RequestBody
DataSetRowPermissionsDTO
request
)
{
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
return
(
List
<
Object
>)
rowPermissionService
.
authObjs
(
request
);
}
@ApiOperation
(
"详情"
)
@PostMapping
(
"/dataSetRowPermissionInfo"
)
public
DataSetRowPermissionsDTO
dataSetRowPermissionInfo
(
@RequestBody
DataSetRowPermissionsDTO
request
)
{
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
return
rowPermissionService
.
dataSetRowPermissionInfo
(
request
);
}
}
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
4786d23d
...
...
@@ -33,7 +33,9 @@ import io.dataease.exception.DataEaseException;
import
io.dataease.i18n.Translator
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.loader.ClassloaderResponsity
;
import
io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO
;
import
io.dataease.plugins.xpack.auth.dto.request.DatasetRowPermissions
;
import
io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO
;
import
io.dataease.plugins.xpack.auth.service.RowPermissionService
;
import
io.dataease.provider.ProviderFactory
;
import
io.dataease.provider.datasource.DatasourceProvider
;
...
...
@@ -463,9 +465,17 @@ public class DataSetTableService {
deptId
=
authUserService
.
getUserById
(
userId
).
getDeptId
();
roleIds
=
authUserService
.
roles
(
userId
).
stream
().
map
(
r
->
Long
.
valueOf
(
r
)).
collect
(
Collectors
.
toList
());
}
datasetRowPermissions
.
addAll
(
rowPermissionService
.
listDatasetRowPermissions
(
datasetId
,
Collections
.
singletonList
(
userId
),
"user"
));
datasetRowPermissions
.
addAll
(
rowPermissionService
.
listDatasetRowPermissions
(
datasetId
,
roleIds
,
"role"
));
datasetRowPermissions
.
addAll
(
rowPermissionService
.
listDatasetRowPermissions
(
datasetId
,
Collections
.
singletonList
(
deptId
),
"dept"
));
DataSetRowPermissionsDTO
dataSetRowPermissionsDTO
=
new
DataSetRowPermissionsDTO
();
dataSetRowPermissionsDTO
.
setDatasetId
(
datasetId
);
dataSetRowPermissionsDTO
.
setAuthTargetIds
(
Collections
.
singletonList
(
userId
));
dataSetRowPermissionsDTO
.
setAuthTargetType
(
"user"
);
datasetRowPermissions
.
addAll
(
rowPermissionService
.
searchRowPermissions
(
dataSetRowPermissionsDTO
));
dataSetRowPermissionsDTO
.
setAuthTargetIds
(
roleIds
);
dataSetRowPermissionsDTO
.
setAuthTargetType
(
"role"
);
datasetRowPermissions
.
addAll
(
rowPermissionService
.
searchRowPermissions
(
dataSetRowPermissionsDTO
));
dataSetRowPermissionsDTO
.
setAuthTargetIds
(
Collections
.
singletonList
(
deptId
));
dataSetRowPermissionsDTO
.
setAuthTargetType
(
"dept"
);
datasetRowPermissions
.
addAll
(
rowPermissionService
.
searchRowPermissions
(
dataSetRowPermissionsDTO
));
return
datasetRowPermissions
;
}
...
...
@@ -481,26 +491,24 @@ public class DataSetTableService {
public
List
<
ChartFieldCustomFilterDTO
>
getCustomFilters
(
List
<
DatasetTableField
>
fields
,
DatasetTable
datasetTable
,
Long
user
)
{
List
<
ChartFieldCustomFilterDTO
>
customFilter
=
new
ArrayList
<>();
rowPermissions
(
datasetTable
.
getId
(),
user
).
forEach
(
datasetRowPermissions
->
{
for
(
DatasetRowPermissions
datasetRowPermissions
:
rowPermissions
(
datasetTable
.
getId
(),
user
))
{
ChartFieldCustomFilterDTO
dto
=
new
ChartFieldCustomFilterDTO
();
DatasetTableField
field
=
getFieldById
(
fields
,
datasetRowPermissions
.
getDatasetFieldId
());
if
(
field
==
null
){
continue
;}
dto
.
setField
(
field
);
dto
.
setId
(
field
.
getId
());
dto
.
setFilterType
(
datasetRowPermissions
.
getFilterType
());
if
(
datasetRowPermissions
.
getFilterType
().
equalsIgnoreCase
(
"logic"
)){
List
<
ChartCustomFilterItemDTO
>
lists
=
JSONObject
.
parseArray
(
datasetRowPermissions
.
getFilter
(),
ChartCustomFilterItemDTO
.
class
);
lists
.
forEach
(
chartCustomFilterDTO
->
{
chartCustomFilterDTO
.
setFieldId
(
field
.
getId
());
});
if
(
field
!=
null
)
{
dto
.
setFilter
(
lists
);
dto
.
setLogic
(
datasetRowPermissions
.
getLogic
());
customFilter
.
add
(
dto
);
}
dto
.
setFilter
(
lists
);
dto
.
setLogic
(
datasetRowPermissions
.
getLogic
());
customFilter
.
add
(
dto
);
}
else
{
dto
.
setEnumCheckField
(
Arrays
.
asList
(
datasetRowPermissions
.
getEnumCheckField
().
split
(
","
).
clone
()));
customFilter
.
add
(
dto
);
}
});
}
return
customFilter
;
}
...
...
frontend/src/api/dataset/dataset.js
浏览文件 @
4786d23d
...
...
@@ -175,7 +175,7 @@ export function datasetTaskList(page, size, data, loading) {
export
function
datasetRowPermissionsList
(
datasetId
,
page
,
size
,
data
,
loading
)
{
return
request
({
url
:
'
/dataset/rowp
ermissions/pageList/'
+
datasetId
+
'/'
+
page
+
'/'
+
size
,
url
:
'
plugin/dataset/rowP
ermissions/pageList/'
+
datasetId
+
'/'
+
page
+
'/'
+
size
,
method
:
'post'
,
data
,
loading
:
loading
...
...
frontend/src/components/AsyncComponent/index.vue
浏览文件 @
4786d23d
...
...
@@ -3,6 +3,7 @@
:is=
"mode"
v-bind=
"$attrs"
v-on=
"$listeners"
:obj=
"obj"
/>
</
template
>
...
...
@@ -18,6 +19,10 @@ export default {
url
:
{
type
:
String
,
default
:
''
},
obj
:
{
type
:
Object
,
default
:
{}
}
},
data
()
{
...
...
frontend/src/lang/en.js
浏览文件 @
4786d23d
...
...
@@ -1187,7 +1187,13 @@ export default {
value
:
'Value'
,
add
:
'Add row permissions'
,
edit
:
'Edit row permissions'
,
please_select_field
:
'Please select a field'
please_select_field
:
'Please select a field'
,
please_select_auth_type
:
'Please select the authorization type'
,
please_select_auth_id
:
'Please select authorization target'
,
row_permission_not_empty
:
'Row permission cannot be empty'
,
search_by_filed_name
:
'Search by field name'
,
auth_type
:
'Authorization type'
,
auth_obj
:
'Authorized object'
},
row_permissions
:
'Row Permissions'
,
union_data
:
'Union Dataset'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
4786d23d
...
...
@@ -1187,7 +1187,13 @@ export default {
value
:
'值'
,
add
:
'添加行權限'
,
edit
:
'編輯行權限'
,
please_select_field
:
'請選擇字段'
please_select_field
:
'請選擇字段'
,
please_select_auth_type
:
'請選擇授權類型'
,
please_select_auth_id
:
'請選擇授權目標'
,
row_permission_not_empty
:
'行權限不能為空'
,
search_by_filed_name
:
'根據字段名稱搜索'
,
auth_type
:
'授權類型'
,
auth_obj
:
'授權對象'
},
row_permissions
:
'行權限'
,
union_data
:
'關聯數據集'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
4786d23d
...
...
@@ -1190,7 +1190,13 @@ export default {
value
:
'值'
,
add
:
'添加行权限'
,
edit
:
'编辑行权限'
,
please_select_field
:
'请选择字段'
please_select_field
:
'请选择字段'
,
please_select_auth_type
:
'请选择授权类型'
,
please_select_auth_id
:
'请选择授权目标'
,
row_permission_not_empty
:
'行权限不能为空'
,
search_by_filed_name
:
'根据字段名称搜索'
,
auth_type
:
'授权类型'
,
auth_obj
:
'授权对象'
},
row_permissions
:
'行权限'
,
union_data
:
'关联数据集'
,
...
...
frontend/src/views/dataset/data/ViewTable.vue
浏览文件 @
4786d23d
...
...
@@ -62,6 +62,9 @@
<el-tab-pane
v-if=
"table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql')"
:label=
"$t('dataset.update_info')"
name=
"updateInfo"
>
<update-info
v-if=
"tabActive=='updateInfo'"
:param=
"param"
:table=
"table"
/>
</el-tab-pane>
<el-tab-pane
v-if=
"isPluginLoaded"
:lazy=
"true"
:label=
"$t('dataset.row_permissions')"
name=
"second"
>
<plugin-com
v-if=
"isPluginLoaded"
ref=
"RowPermissions"
component-name=
"RowPermissions"
:obj=
"table"
/>
</el-tab-pane>
</el-tabs>
</el-row>
</
template
>
...
...
@@ -73,10 +76,12 @@ import UpdateInfo from './UpdateInfo'
import
DatasetChartDetail
from
'../common/DatasetChartDetail'
import
UnionView
from
'./UnionView'
import
FieldEdit
from
'./FieldEdit'
import
{
pluginLoaded
}
from
'@/api/user'
import
PluginCom
from
'@/views/system/plugin/PluginCom'
export
default
{
name
:
'ViewTable'
,
components
:
{
FieldEdit
,
UnionView
,
DatasetChartDetail
,
UpdateInfo
,
TabDataPreview
},
components
:
{
FieldEdit
,
UnionView
,
DatasetChartDetail
,
UpdateInfo
,
TabDataPreview
,
PluginCom
},
props
:
{
param
:
{
type
:
Object
,
...
...
@@ -99,9 +104,15 @@ export default {
tableViewRowForm
:
{
row
:
1000
},
tabStatus
:
false
tabStatus
:
false
,
isPluginLoaded
:
false
}
},
beforeCreate
()
{
pluginLoaded
().
then
(
res
=>
{
this
.
isPluginLoaded
=
res
.
success
&&
res
.
data
})
},
computed
:
{
hideCustomDs
:
function
()
{
return
this
.
$store
.
getters
.
hideCustomDs
...
...
frontend/src/views/system/plugin/PluginCom.vue
浏览文件 @
4786d23d
<
template
>
<div>
<async-component
v-if=
"showAsync"
:url=
"url"
@
execute-axios=
"executeAxios"
@
on-add-languanges=
"addLanguages"
@
plugin-call-back=
"pluginCallBack"
/>
<async-component
v-if=
"showAsync"
:url=
"url"
:obj=
"obj"
@
execute-axios=
"executeAxios"
@
on-add-languanges=
"addLanguages"
@
plugin-call-back=
"pluginCallBack"
/>
<div
v-else
>
<h1>
未知组件无法展示
</h1>
</div>
...
...
@@ -21,6 +21,10 @@ export default {
componentName
:
{
type
:
String
,
default
:
null
},
obj
:
{
type
:
Object
,
default
:
{}
}
},
data
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论