forked from github/dataease
Merge pull request #2723 from dataease/fix_panel-jump
refactor(xpack): 权限管理交互优化
This commit is contained in:
commit
e863221a6f
@ -9,19 +9,25 @@ import io.dataease.controller.handler.annotation.I18n;
|
|||||||
import io.dataease.dto.SysLogDTO;
|
import io.dataease.dto.SysLogDTO;
|
||||||
import io.dataease.listener.util.CacheUtils;
|
import io.dataease.listener.util.CacheUtils;
|
||||||
import io.dataease.plugins.common.dto.DatasourceBaseType;
|
import io.dataease.plugins.common.dto.DatasourceBaseType;
|
||||||
|
import io.dataease.plugins.common.dto.datasource.DataSourceType;
|
||||||
import io.dataease.plugins.config.SpringContextUtil;
|
import io.dataease.plugins.config.SpringContextUtil;
|
||||||
import io.dataease.plugins.xpack.auth.dto.request.XpackBaseTreeRequest;
|
import io.dataease.plugins.xpack.auth.dto.request.XpackBaseTreeRequest;
|
||||||
import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest;
|
import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest;
|
||||||
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail;
|
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail;
|
||||||
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO;
|
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO;
|
||||||
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
|
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
|
||||||
|
import io.dataease.service.datasource.DatasourceService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
|
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@RequestMapping("/plugin/auth")
|
@RequestMapping("/plugin/auth")
|
||||||
@RestController
|
@RestController
|
||||||
@ -29,6 +35,9 @@ public class XAuthServer {
|
|||||||
|
|
||||||
private static final Set<String> cacheTypes = new HashSet<>();
|
private static final Set<String> cacheTypes = new HashSet<>();
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DatasourceService datasourceService;
|
||||||
|
|
||||||
@RequiresPermissions("auth:read")
|
@RequiresPermissions("auth:read")
|
||||||
@PostMapping("/authModels")
|
@PostMapping("/authModels")
|
||||||
@I18n
|
@I18n
|
||||||
@ -149,7 +158,16 @@ public class XAuthServer {
|
|||||||
|
|
||||||
@GetMapping("/getDatasourceTypes")
|
@GetMapping("/getDatasourceTypes")
|
||||||
public List<DatasourceBaseType> getDatasourceTypes(){
|
public List<DatasourceBaseType> getDatasourceTypes(){
|
||||||
|
Collection<DataSourceType> activeType = datasourceService.types();
|
||||||
|
Map<String,String> activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName));
|
||||||
|
activeTypeMap.put("all","所有数据源");
|
||||||
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
|
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
|
||||||
return sysAuthService.getDatasourceTypes();
|
List<DatasourceBaseType> presentTypes = sysAuthService.getDatasourceTypes();
|
||||||
|
presentTypes.stream().forEach(datasourceBaseType -> {
|
||||||
|
if(activeTypeMap.get(datasourceBaseType.getType())!=null){
|
||||||
|
datasourceBaseType.setName(activeTypeMap.get(datasourceBaseType.getType()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return presentTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1898,7 +1898,8 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
no_item_selected: 'Please select resources on the left',
|
no_item_selected: 'Please select organization、user or role on the left',
|
||||||
|
no_resource_selected: 'Please select resource on the left',
|
||||||
search_pre: 'Search by ',
|
search_pre: 'Search by ',
|
||||||
search_suf: ' name',
|
search_suf: ' name',
|
||||||
separate_auth: 'Separate Authorization',
|
separate_auth: 'Separate Authorization',
|
||||||
|
@ -1907,7 +1907,8 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
no_item_selected: '请在左侧选择资源',
|
no_item_selected: '请在左侧选择组织、角色或用户',
|
||||||
|
no_resource_selected: '请在左侧选择资源',
|
||||||
search_pre: '通过',
|
search_pre: '通过',
|
||||||
search_suf: '名称来搜索',
|
search_suf: '名称来搜索',
|
||||||
separate_auth: '单独授权',
|
separate_auth: '单独授权',
|
||||||
|
@ -1916,7 +1916,8 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
no_item_selected: '请在左侧选择资源',
|
no_item_selected: '请在左侧选择组织、角色或用户',
|
||||||
|
no_resource_selected: '请在左侧选择资源',
|
||||||
search_pre: '通过',
|
search_pre: '通过',
|
||||||
search_suf: '名称来搜索',
|
search_suf: '名称来搜索',
|
||||||
separate_auth: '单独授权',
|
separate_auth: '单独授权',
|
||||||
|
Loading…
Reference in New Issue
Block a user