提交 68f6a6e7 authored 作者: junjie's avatar junjie

fix(权限): 统一授权数据集tree

上级 6f50a9ca
...@@ -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
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)) 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{
.tree-list>>>.el-tree-node__expand-icon.is-leaf{
display: none; display: none;
} }
.custom-tree-node {
.custom-tree-node {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 14px; font-size: 14px;
padding-right: 8px; padding-right: 8px;
} }
.custom-tree-node-list {
.custom-tree-node-list {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 14px; font-size: 14px;
padding:0 8px; padding:0 8px;
} }
.custom-position {
.custom-position {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.form-item {
.form-item {
margin-bottom: 0; margin-bottom: 0;
} }
.title-css {
.title-css {
height: 26px; height: 26px;
} }
.title-text {
.title-text {
line-height: 26px; line-height: 26px;
} }
.scene-title{
.scene-title{
width: 100%; width: 100%;
display: flex; display: flex;
} }
.scene-title-name{ .scene-title-name{
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.tree-style { .tree-style {
padding: 10px; padding: 10px;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论