diff --git a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java index 9b1b32e2ef..331d6b1c58 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XAuthServer.java @@ -9,19 +9,25 @@ import io.dataease.controller.handler.annotation.I18n; import io.dataease.dto.SysLogDTO; import io.dataease.listener.util.CacheUtils; 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.xpack.auth.dto.request.XpackBaseTreeRequest; 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.XpackSysAuthDetailDTO; 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.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; import io.dataease.plugins.xpack.auth.service.AuthXpackService; import springfox.documentation.annotations.ApiIgnore; + +import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; + @ApiIgnore @RequestMapping("/plugin/auth") @RestController @@ -29,6 +35,9 @@ public class XAuthServer { private static final Set cacheTypes = new HashSet<>(); + @Resource + private DatasourceService datasourceService; + @RequiresPermissions("auth:read") @PostMapping("/authModels") @I18n @@ -149,7 +158,16 @@ public class XAuthServer { @GetMapping("/getDatasourceTypes") public List getDatasourceTypes(){ + Collection activeType = datasourceService.types(); + Map activeTypeMap = activeType.stream().collect(Collectors.toMap(DataSourceType::getType, DataSourceType::getName)); + activeTypeMap.put("all","所有数据源"); AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class); - return sysAuthService.getDatasourceTypes(); + List presentTypes = sysAuthService.getDatasourceTypes(); + presentTypes.stream().forEach(datasourceBaseType -> { + if(activeTypeMap.get(datasourceBaseType.getType())!=null){ + datasourceBaseType.setName(activeTypeMap.get(datasourceBaseType.getType())); + } + }); + return presentTypes; } } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 9542bd31bf..601ede8cb5 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1898,7 +1898,8 @@ export default { }, 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_suf: ' name', separate_auth: 'Separate Authorization', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 64e2f8a689..80e5737eb0 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1907,7 +1907,8 @@ export default { }, auth: { - no_item_selected: '请在左侧选择资源', + no_item_selected: '请在左侧选择组织、角色或用户', + no_resource_selected: '请在左侧选择资源', search_pre: '通过', search_suf: '名称来搜索', separate_auth: '单独授权', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 0b9fe75c47..36c5806397 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1916,7 +1916,8 @@ export default { }, auth: { - no_item_selected: '请在左侧选择资源', + no_item_selected: '请在左侧选择组织、角色或用户', + no_resource_selected: '请在左侧选择资源', search_pre: '通过', search_suf: '名称来搜索', separate_auth: '单独授权',