forked from github/dataease
commit
f50ee8d1d6
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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()))) {
|
||||
|
@ -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()
|
||||
})
|
||||
|
@ -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']
|
||||
|
@ -340,7 +340,7 @@ export default {
|
||||
{ required: true, message: this.$t('dataset.required'), trigger: 'change' }
|
||||
]
|
||||
},
|
||||
customType: ['db', 'sql']
|
||||
customType: ['db', 'sql', 'api']
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
Loading…
Reference in New Issue
Block a user