forked from github/dataease
fix(权限): 统一授权数据集tree
This commit is contained in:
parent
6f50a9ca56
commit
68f6a6e749
@ -8,6 +8,6 @@ import java.util.List;
|
||||
|
||||
public interface ExtVAuthModelMapper {
|
||||
|
||||
List<VAuthModelDTO> queryAuthModel (@Param("record") VAuthModelRequest request);
|
||||
List<VAuthModelDTO> queryAuthModel (@Param("record") VAuthModelRequest record);
|
||||
|
||||
}
|
||||
|
@ -19,9 +19,10 @@
|
||||
v_auth_model.create_by,
|
||||
v_auth_model.level,
|
||||
v_auth_model.mode,
|
||||
v_auth_model.data_source_id,
|
||||
authInfo.PRIVILEGES AS `privileges`
|
||||
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
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
@ -35,19 +36,19 @@
|
||||
)))
|
||||
WHERE
|
||||
sys_auth_detail.privilege_value = 1
|
||||
AND sys_auth.auth_source_type = #{request.modelType}
|
||||
AND sys_auth.auth_source_type = #{record.modelType}
|
||||
AND (
|
||||
(
|
||||
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 (
|
||||
sys_auth.auth_target_type = 'user'
|
||||
AND sys_auth.auth_target = #{request.userId}
|
||||
AND sys_auth.auth_target = #{record.userId}
|
||||
)
|
||||
OR (
|
||||
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
|
||||
@ -92,11 +93,14 @@
|
||||
and v_auth_model.`label` = #{record.label,jdbcType=LONGVARCHAR}
|
||||
</if>
|
||||
<if test="record.modelInnerTypeArray != null and record.modelInnerTypeArray.size() > 0">
|
||||
v_auth_model.model_inner_type in
|
||||
<foreach collection="modelInnerTypeArray" item="item" separator="," open="(" close=")">
|
||||
and v_auth_model.model_inner_type in
|
||||
<foreach collection="record.modelInnerTypeArray" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</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
|
||||
</select>
|
||||
|
||||
|
@ -78,10 +78,7 @@
|
||||
|
||||
<script>
|
||||
import { isKettleRunning, post } from '@/api/dataset/dataset'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
import { queryAuthModel } from '@/api/authModel/authModel'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'DatasetGroupSelectorTree',
|
||||
props: {
|
||||
@ -134,7 +131,7 @@ export default {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -198,7 +195,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.treeNode(true)
|
||||
this.treeNode()
|
||||
},
|
||||
created() {
|
||||
this.kettleState()
|
||||
@ -220,7 +217,6 @@ export default {
|
||||
sort: 'type desc,name asc'
|
||||
}
|
||||
},
|
||||
|
||||
closeTable() {
|
||||
this.editTable = false
|
||||
this.tableForm = {
|
||||
@ -233,8 +229,18 @@ export default {
|
||||
if (userCache) {
|
||||
this.data = JSON.parse(modelInfo)
|
||||
}
|
||||
queryAuthModel({ modelType: 'dataset', privileges: this.privileges, datasetMode: this.mode, clearEmptyDir: this.clearEmptyDir}, !userCache).then(res => {
|
||||
localStorage.setItem('dataset-tree', JSON.stringify(res.data))
|
||||
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))
|
||||
}
|
||||
if (!userCache) {
|
||||
this.data = res.data
|
||||
}
|
||||
@ -253,11 +259,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
this.sceneMode = false
|
||||
},
|
||||
|
||||
sceneClick(data, node) {
|
||||
if (data.disabled) {
|
||||
this.$message({
|
||||
@ -287,7 +291,6 @@ export default {
|
||||
this.$emit('getTable', data)
|
||||
}
|
||||
},
|
||||
|
||||
unionDataChange() {
|
||||
if (!this.sceneMode) {
|
||||
return
|
||||
@ -311,7 +314,6 @@ export default {
|
||||
})
|
||||
unionList.push(this.checkedList[0].tableId)
|
||||
const notUnionList = tableList.concat(unionList).filter(v => tableList.includes(v) && !unionList.includes(v))
|
||||
|
||||
notUnionList.forEach(ele => {
|
||||
const span = document.getElementById(ele).parentNode
|
||||
const div1 = span.parentNode
|
||||
@ -321,7 +323,6 @@ export default {
|
||||
div2.style.setProperty('pointer-events', 'none')
|
||||
})
|
||||
},
|
||||
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
this.expandedArray.push(data.id)
|
||||
@ -353,76 +354,66 @@ export default {
|
||||
searchTypeClick(searchTypeInfo) {
|
||||
this.searchType = searchTypeInfo
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-divider--horizontal {
|
||||
margin: 12px 0
|
||||
}
|
||||
|
||||
.search-input {
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.tree-list>>>.el-tree-node__expand-icon.is-leaf{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.custom-tree-node-list {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding:0 8px;
|
||||
}
|
||||
|
||||
.custom-position {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.title-css {
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.scene-title{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.scene-title-name{
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tree-style {
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 12px 0
|
||||
}
|
||||
.search-input {
|
||||
padding: 12px 0;
|
||||
}
|
||||
.tree-list>>>.el-tree-node__expand-icon.is-leaf{
|
||||
display: none;
|
||||
}
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
.custom-tree-node-list {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding:0 8px;
|
||||
}
|
||||
.custom-position {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
.form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.title-css {
|
||||
height: 26px;
|
||||
}
|
||||
.title-text {
|
||||
line-height: 26px;
|
||||
}
|
||||
.scene-title{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.scene-title-name{
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tree-style {
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user