Unverified 提交 db04aabd authored 作者: XiaJunjie2020's avatar XiaJunjie2020 提交者: GitHub

Merge pull request #1326 from dataease/pr@dev@fix_auth_tree

fix(权限): 统一授权数据集tree
...@@ -8,6 +8,6 @@ import java.util.List; ...@@ -8,6 +8,6 @@ import java.util.List;
public interface ExtVAuthModelMapper { public interface ExtVAuthModelMapper {
List<VAuthModelDTO> queryAuthModel (@Param("record") VAuthModelRequest request); List<VAuthModelDTO> queryAuthModel (@Param("record") VAuthModelRequest record);
} }
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
v_auth_model.create_by, v_auth_model.create_by,
v_auth_model.level, v_auth_model.level,
v_auth_model.mode, v_auth_model.mode,
v_auth_model.data_source_id,
authInfo.PRIVILEGES AS `privileges` authInfo.PRIVILEGES AS `privileges`
FROM FROM
( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{request.userId}, #{request.modelType} ) cids ) t, ( SELECT GET_V_AUTH_MODEL_ID_P_USE ( #{record.userId}, #{record.modelType} ) cids ) t,
v_auth_model v_auth_model
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -35,19 +36,19 @@ ...@@ -35,19 +36,19 @@
))) )))
WHERE WHERE
sys_auth_detail.privilege_value = 1 sys_auth_detail.privilege_value = 1
AND sys_auth.auth_source_type = #{request.modelType} AND sys_auth.auth_source_type = #{record.modelType}
AND ( AND (
( (
sys_auth.auth_target_type = 'dept' sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{request.userId} ) AND sys_auth.auth_target IN ( SELECT dept_id FROM sys_user WHERE user_id = #{record.userId} )
) )
OR ( OR (
sys_auth.auth_target_type = 'user' sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = #{request.userId} AND sys_auth.auth_target = #{record.userId}
) )
OR ( OR (
sys_auth.auth_target_type = 'role' sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{request.userId} ) AND sys_auth.auth_target IN ( SELECT role_id FROM sys_users_roles WHERE user_id = #{record.userId} )
) )
) )
GROUP BY GROUP BY
...@@ -92,11 +93,14 @@ ...@@ -92,11 +93,14 @@
and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR} and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR}
</if> </if>
<if test="record.modelInnerTypeArray != null and record.modelInnerTypeArray.size() > 0"> <if test="record.modelInnerTypeArray != null and record.modelInnerTypeArray.size() > 0">
v_auth_model.model_inner_type in and v_auth_model.model_inner_type in
<foreach collection="modelInnerTypeArray" item="item" separator="," open="(" close=")"> <foreach collection="record.modelInnerTypeArray" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test='record.modelType != null and record.modelType == "dataset"'>
or (v_auth_model.`model_inner_type` = 'group' and v_auth_model.model_type = 'dataset')
</if>
ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc ORDER BY v_auth_model.node_type desc, CONVERT(v_auth_model.label using gbk) asc
</select> </select>
......
...@@ -78,10 +78,7 @@ ...@@ -78,10 +78,7 @@
<script> <script>
import { isKettleRunning, post } from '@/api/dataset/dataset' import { isKettleRunning, post } from '@/api/dataset/dataset'
import { hasDataPermission } from '@/utils/permission'
import { queryAuthModel } from '@/api/authModel/authModel' import { queryAuthModel } from '@/api/authModel/authModel'
export default { export default {
name: 'DatasetGroupSelectorTree', name: 'DatasetGroupSelectorTree',
props: { props: {
...@@ -134,7 +131,7 @@ export default { ...@@ -134,7 +131,7 @@ export default {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
}, }
}, },
data() { data() {
return { return {
...@@ -198,7 +195,7 @@ export default { ...@@ -198,7 +195,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.treeNode(true) this.treeNode()
}, },
created() { created() {
this.kettleState() this.kettleState()
...@@ -220,7 +217,6 @@ export default { ...@@ -220,7 +217,6 @@ export default {
sort: 'type desc,name asc' sort: 'type desc,name asc'
} }
}, },
closeTable() { closeTable() {
this.editTable = false this.editTable = false
this.tableForm = { this.tableForm = {
...@@ -233,8 +229,18 @@ export default { ...@@ -233,8 +229,18 @@ export default {
if (userCache) { if (userCache) {
this.data = JSON.parse(modelInfo) this.data = JSON.parse(modelInfo)
} }
queryAuthModel({ modelType: 'dataset', privileges: this.privileges, datasetMode: this.mode, clearEmptyDir: this.clearEmptyDir}, !userCache).then(res => { this.customType ? this.customType.push('group') : null
localStorage.setItem('dataset-tree', JSON.stringify(res.data)) queryAuthModel({
modelType: 'dataset',
privileges: this.privileges,
datasetMode: this.mode,
clearEmptyDir: this.clearEmptyDir,
mode: this.mode < 0 ? null : this.mode,
modelInnerTypeArray: this.customType
}, !userCache).then(res => {
if (cache) {
localStorage.setItem('dataset-tree', JSON.stringify(res.data))
}
if (!userCache) { if (!userCache) {
this.data = res.data this.data = res.data
} }
...@@ -253,11 +259,9 @@ export default { ...@@ -253,11 +259,9 @@ export default {
} }
} }
}, },
back() { back() {
this.sceneMode = false this.sceneMode = false
}, },
sceneClick(data, node) { sceneClick(data, node) {
if (data.disabled) { if (data.disabled) {
this.$message({ this.$message({
...@@ -287,7 +291,6 @@ export default { ...@@ -287,7 +291,6 @@ export default {
this.$emit('getTable', data) this.$emit('getTable', data)
} }
}, },
unionDataChange() { unionDataChange() {
if (!this.sceneMode) { if (!this.sceneMode) {
return return
...@@ -311,7 +314,6 @@ export default { ...@@ -311,7 +314,6 @@ export default {
}) })
unionList.push(this.checkedList[0].tableId) unionList.push(this.checkedList[0].tableId)
const notUnionList = tableList.concat(unionList).filter(v => tableList.includes(v) && !unionList.includes(v)) const notUnionList = tableList.concat(unionList).filter(v => tableList.includes(v) && !unionList.includes(v))
notUnionList.forEach(ele => { notUnionList.forEach(ele => {
const span = document.getElementById(ele).parentNode const span = document.getElementById(ele).parentNode
const div1 = span.parentNode const div1 = span.parentNode
...@@ -321,7 +323,6 @@ export default { ...@@ -321,7 +323,6 @@ export default {
div2.style.setProperty('pointer-events', 'none') div2.style.setProperty('pointer-events', 'none')
}) })
}, },
nodeExpand(data) { nodeExpand(data) {
if (data.id) { if (data.id) {
this.expandedArray.push(data.id) this.expandedArray.push(data.id)
...@@ -353,76 +354,66 @@ export default { ...@@ -353,76 +354,66 @@ export default {
searchTypeClick(searchTypeInfo) { searchTypeClick(searchTypeInfo) {
this.searchType = searchTypeInfo this.searchType = searchTypeInfo
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.el-divider--horizontal { .el-divider--horizontal {
margin: 12px 0 margin: 12px 0
} }
.search-input {
.search-input { padding: 12px 0;
padding: 12px 0; }
} .tree-list>>>.el-tree-node__expand-icon.is-leaf{
display: none;
.tree-list>>>.el-tree-node__expand-icon.is-leaf{ }
display: none; .custom-tree-node {
} flex: 1;
display: flex;
.custom-tree-node { align-items: center;
flex: 1; justify-content: space-between;
display: flex; font-size: 14px;
align-items: center; padding-right: 8px;
justify-content: space-between; }
font-size: 14px; .custom-tree-node-list {
padding-right: 8px; flex: 1;
} display: flex;
align-items: center;
.custom-tree-node-list { justify-content: space-between;
flex: 1; font-size: 14px;
display: flex; padding:0 8px;
align-items: center; }
justify-content: space-between; .custom-position {
font-size: 14px; flex: 1;
padding:0 8px; display: flex;
} align-items: center;
font-size: 14px;
.custom-position { flex-flow: row nowrap;
flex: 1; }
display: flex; .form-item {
align-items: center; margin-bottom: 0;
font-size: 14px; }
flex-flow: row nowrap; .title-css {
} height: 26px;
}
.form-item { .title-text {
margin-bottom: 0; line-height: 26px;
} }
.scene-title{
.title-css { width: 100%;
height: 26px; display: flex;
} }
.scene-title-name{
.title-text { width: 100%;
line-height: 26px; overflow: hidden;
} display: inline-block;
white-space: nowrap;
.scene-title{ text-overflow: ellipsis;
width: 100%; }
display: flex; .tree-style {
} padding: 10px;
.scene-title-name{ height: 100%;
width: 100%; overflow-y: auto;
overflow: hidden; }
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
}
.tree-style {
padding: 10px;
height: 100%;
overflow-y: auto;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论