fix:修复普通用户创建视图权限查不到的问题

This commit is contained in:
wangjiahao 2021-07-29 15:05:23 +08:00
parent 8a2069c32a
commit fdf8ca012d
4 changed files with 11 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package io.dataease.controller.chart;
import io.dataease.base.domain.ChartViewWithBLOBs;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.dto.chart.ChartViewDTO;
@ -68,6 +69,12 @@ public class ChartViewController {
@PostMapping("/getOneWithPermission/{id}")
public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
return chartViewService.getData(id, requestList);
//如果能获取用户 则添加对应的权限
ChartViewDTO dto = chartViewService.getData(id, requestList);
if(dto!=null && AuthUtils.getUser()!=null){
ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId());
dto.setPrivileges(permissionDto.getPrivileges());
}
return dto;
}
}

View File

@ -315,12 +315,6 @@ public class ChartViewService {
BeanUtils.copyBean(dto, view);
dto.setData(map);
dto.setSql(datasourceRequest.getQuery());
//如果能获取用户 则添加对应的权限
if(AuthUtils.getUser()!=null){
ChartViewDTO permissionDto = getOneWithPermission(dto.getId());
dto.setPrivileges(permissionDto.getPrivileges());
}
return dto;
}

View File

@ -4,7 +4,6 @@
<el-dropdown trigger="click" @mouseup="handleMouseUp">
<slot name="icon" />
<el-dropdown-menu>
this is test
<el-dropdown-item v-if="curComponent&&editFilter.includes(curComponent.type)" icon="el-icon-edit-outline" @click.native="edit">{{ $t('panel.edit') }}</el-dropdown-item>
<el-dropdown-item icon="el-icon-document-copy" @click.native="copy">{{ $t('panel.copy') }}</el-dropdown-item>
<el-dropdown-item icon="el-icon-delete" @click.native="deleteComponent">{{ $t('panel.delete') }}</el-dropdown-item>

View File

@ -908,7 +908,9 @@ export default {
this.data = response.data.data
// console.log(JSON.stringify(this.chart))
this.httpRequest.status = true
if (this.chart.privileges) {
this.param.privileges = this.chart.privileges
}
}).catch(err => {
this.resetView()
this.httpRequest.status = err.response.data.success