fix: restore strict column permission control
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -515,8 +515,8 @@ const permissionMap: Record<string, string> = {
|
||||
type: 'material_list:type',
|
||||
spec: 'material_list:spec',
|
||||
unit: 'material_list:unit',
|
||||
inventory: 'material_list:inventoryCount', // 前端变量是 inventory,数据库Code是 inventoryCount
|
||||
available: 'material_list:availableCount', // 前端变量是 available,数据库Code是 availableCount
|
||||
inventory: 'material_list:inventoryCount',
|
||||
available: 'material_list:availableCount',
|
||||
files: 'material_list:files',
|
||||
isEnabled: 'material_list:isEnabled'
|
||||
};
|
||||
@ -528,16 +528,14 @@ const initColumnPermissions = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 普通用户:不再根据权限隐藏列,而是显示所有列,由后端控制字段值
|
||||
// 所以这里不做任何操作,保持columns的默认visible(true)
|
||||
// 但是,我们也可以选择性地根据权限隐藏列,但用户要求列显示,所以不隐藏
|
||||
// 因此,注释掉下面的代码
|
||||
// Object.keys(columns).forEach(key => {
|
||||
// const code = permissionMap[key];
|
||||
// if (code) {
|
||||
// columns[key].visible = !!userStore.hasPermission(code);
|
||||
// }
|
||||
// });
|
||||
// 普通用户:严格执行列级权限控制,没有权限的列必须隐藏
|
||||
Object.keys(columns).forEach(key => {
|
||||
const code = permissionMap[key];
|
||||
if (code) {
|
||||
// 如果不具备该权限,必须设为 false
|
||||
columns[key].visible = !!userStore.hasPermission(code);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const companyOptions = ref<string[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user