Merge pull request #1872 from dataease/v1.8

V1.8
This commit is contained in:
王嘉豪 2022-03-02 17:55:26 +08:00 committed by GitHub
commit f50ee8d1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 60 deletions

View File

@ -1,28 +0,0 @@
package io.dataease.auth.api;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("api/data")
public class demo {
@ApiOperation("查询")
@GetMapping("demo")
public Object listByTableId() {
JSONArray jsonArray = new JSONArray();
for(int i=0;i<10;i++){
JSONObject jsonObject = new JSONObject();
for(int j=0;j<1;j++){
jsonObject.set("column" +i + j, "value"+i+j);
}
jsonArray.put(jsonObject);
}
return jsonArray;
}
}

View File

@ -20,7 +20,6 @@ public class ShiroServiceImpl implements ShiroService {
// ----------------------------------------------------------
// 放行Swagger2页面需要放行这些
filterChainDefinitionMap.put("/api/data/demo", ANON);
filterChainDefinitionMap.put("/doc.html**", "doc");
filterChainDefinitionMap.put("/deApi**", ANON);
filterChainDefinitionMap.put("/swagger-ui.html", ANON);

View File

@ -64,12 +64,12 @@ public class ColumnPermissionsController {
return columnPermissionService.searchPermissions(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void delete(@PathVariable String id) {
@PostMapping("/delete")
public void delete(@RequestBody DatasetColumnPermissions datasetColumnPermissions) {
ColumnPermissionService columnPermissionService = SpringContextUtil.getBean(ColumnPermissionService.class);
columnPermissionService.delete(id);
columnPermissionService.delete(datasetColumnPermissions.getId());
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)

View File

@ -62,12 +62,12 @@ public class RowPermissionsController {
return rowPermissionService.searchRowPermissions(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void dataSetRowPermissionInfo(@PathVariable String id) {
@PostMapping("/delete")
public void dataSetRowPermissionInfo(@RequestBody DatasetRowPermissions datasetRowPermissions) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
rowPermissionService.delete(id);
rowPermissionService.delete(datasetRowPermissions.getId());
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)

View File

@ -26,14 +26,12 @@ public class VAuthModelService {
public List<VAuthModelDTO> queryAuthModel(VAuthModelRequest request) {
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
// 定时任务选数据集时列表需去除空目录
if (request.isClearEmptyDir()) {
request.setMode(null);
}
List<VAuthModelDTO> result = extVAuthModelMapper.queryAuthModel(request);
// 定时任务选数据集时列表需去除空目录
if (request.getPrivileges() != null) {
result = filterPrivileges(request, result);
}
if (request.isClearEmptyDir()) {
result = filterData(request, result);
List<VAuthModelDTO> vAuthModelDTOS = TreeUtils.mergeTree(result);
setAllLeafs(vAuthModelDTOS);
removeEmptyDir(vAuthModelDTOS);
@ -42,16 +40,7 @@ public class VAuthModelService {
return TreeUtils.mergeTree(result);
}
private List<VAuthModelDTO> filterData(VAuthModelRequest request, List<VAuthModelDTO> result) {
if (request.getDatasetMode() != null && request.getDatasetMode() == 1) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getMode().equals(1L)) && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("excel") && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("custom") && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("union")) {
return true;
} else {
return false;
}
}).collect(Collectors.toList());
}
private List<VAuthModelDTO> filterPrivileges(VAuthModelRequest request, List<VAuthModelDTO> result) {
if (request.getPrivileges() != null) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getPrivileges() != null && vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))) {

View File

@ -60,7 +60,7 @@
<!--选择数据集-->
<el-dialog v-if="selectDsDialog" v-dialogDrag :title="$t('chart.select_dataset')" :visible="selectDsDialog" :show-close="false" width="400px" class="dialog-css">
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" @getTable="firstDs" />
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" clear-empty-dir="true" @getTable="firstDs" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeSelectDs()">{{ $t('dataset.cancel') }}</el-button>
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
@ -139,7 +139,7 @@ export default {
allChildCount: 0
},
name: '关联数据集',
customType: ['db', 'sql', 'excel'],
customType: ['db', 'sql', 'excel', 'api'],
selectDsDialog: false,
//
tempDs: {},
@ -185,7 +185,7 @@ export default {
mode: this.dataset[0].currentDs.mode,
info: '{"union":' + JSON.stringify(this.dataset) + '}'
}
post('/dataset/table/update', table).then(response => {
post('/dataset/table/updateUnion', table).then(response => {
this.$emit('saveSuccess', table)
this.cancel()
})

View File

@ -29,7 +29,7 @@
<!--选择数据集-->
<el-dialog v-if="selectDsDialog" v-dialogDrag :title="$t('chart.select_dataset')" :visible="selectDsDialog" :show-close="false" width="400px" class="dialog-css">
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" :mode="currentNode.currentDs.mode" @getTable="firstDs" />
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" clear-empty-dir="true" :mode="currentNode.currentDs.mode" @getTable="firstDs" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeSelectDs()">{{ $t('dataset.cancel') }}</el-button>
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
@ -79,7 +79,7 @@ export default {
},
allChildCount: 0
},
customType: ['db', 'sql', 'excel'],
customType: ['db', 'sql', 'excel', 'api'],
selectDsDialog: false,
//
tempDs: {},
@ -129,7 +129,7 @@ export default {
selectDs() {
// node
if (this.currentNode.currentDs.mode === 1) {
this.customType = ['db', 'sql', 'excel']
this.customType = ['db', 'sql', 'excel', 'api']
} else if (this.currentNode.currentDs.mode === 0) {
if (this.currentNode.currentDs.modelInnerType === 'db') {
this.customType = ['db']

View File

@ -340,7 +340,7 @@ export default {
{ required: true, message: this.$t('dataset.required'), trigger: 'change' }
]
},
customType: ['db', 'sql']
customType: ['db', 'sql', 'api']
}
},
computed: {