refactor(系统设置): 禁止修改系统管理员用户组与权限的读取和设置
This commit is contained in:
parent
af551e05f8
commit
ca1668318a
|
@ -35,7 +35,7 @@
|
||||||
prop="permissions"
|
prop="permissions"
|
||||||
:label="$t('group.permission')">
|
:label="$t('group.permission')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<group-permission :permissions="scope.row.permissions" :selected.sync="tableData" :read-only="readOnly"/>
|
<group-permission :permissions="scope.row.permissions" :selected.sync="tableData" :read-only="readOnly" :group="group"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
:label="$t('group.check_all')">
|
:label="$t('group.check_all')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<el-checkbox @change="handleSelectAll($event, scope.row.permissions)" :disabled="readOnly"/>
|
<el-checkbox @change="handleSelectAll($event, scope.row.permissions)" :disabled="isReadOnly(scope.row)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -83,6 +83,12 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
userGroupType() {
|
userGroupType() {
|
||||||
return USER_GROUP_SCOPE;
|
return USER_GROUP_SCOPE;
|
||||||
|
},
|
||||||
|
isReadOnly() {
|
||||||
|
return function (data) {
|
||||||
|
const isDefaultSystemGroup = this.group.id === 'admin' && data.resource.id === 'SYSTEM_GROUP';
|
||||||
|
return this.readOnly || isDefaultSystemGroup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{{ $t(permission.name) }}
|
{{ $t(permission.name) }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<el-checkbox v-else class="permission-checkbox"
|
<el-checkbox v-else class="permission-checkbox"
|
||||||
v-model="permission['checked']" @change="change($event, permission)" :disabled="readOnly">
|
v-model="permission['checked']" @change="change($event, permission)" :disabled="isReadOnly(permission)">
|
||||||
{{ $t(permission.name) }}
|
{{ $t(permission.name) }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</span>
|
</span>
|
||||||
|
@ -34,11 +34,22 @@ export default {
|
||||||
default() {
|
default() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
group: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
computed: {
|
||||||
return {
|
isReadOnly() {
|
||||||
|
return function (permission) {
|
||||||
|
// 禁止取消系统管理员用户组的读取和设置权限
|
||||||
|
const isSystemGroupPermission = permission.id === 'SYSTEM_GROUP:READ' || permission.id === 'SYSTEM_GROUP:READ+SETTING_PERMISSION';
|
||||||
|
const isDefaultSystemGroup = this.group.id === 'admin' && isSystemGroupPermission;
|
||||||
|
return this.readOnly || isDefaultSystemGroup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue