Skip to content

Commit

Permalink
Update get proxyUser method
Browse files Browse the repository at this point in the history
  • Loading branch information
jefftlin committed Sep 5, 2024
1 parent 666b16b commit b68ec1f
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.webank.wedatasphere.exchangis.job.server.service.JobInfoService;
import com.webank.wedatasphere.exchangis.job.vo.ExchangisJobQueryVo;
import com.webank.wedatasphere.exchangis.job.vo.ExchangisJobVo;
//import com.webank.wedatasphere.exchangis.privilege.entity.ProxyUser;
//import com.webank.wedatasphere.exchangis.privilege.service.ProxyUserService;
import com.webank.wedatasphere.exchangis.privilege.entity.ProxyUser;
import com.webank.wedatasphere.exchangis.privilege.service.ProxyUserService;
import org.apache.linkis.common.exception.ErrorException;
import org.apache.linkis.server.Message;
import org.apache.linkis.server.security.SecurityFilter;
Expand All @@ -35,6 +35,7 @@
import javax.validation.groups.Default;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import static com.webank.wedatasphere.exchangis.job.exception.ExchangisJobExceptionCode.VALIDATE_JOB_ERROR;

Expand All @@ -59,8 +60,8 @@ public class ExchangisJobRestfulApi {
@Resource
private DataSourceUIGetter dataSourceUIGetter;

// @Resource
// private ProxyUserService proxyUserService;
@Resource
private ProxyUserService proxyUserService;

/**
* Query job in page
Expand Down Expand Up @@ -106,9 +107,7 @@ public Message getJobList(@RequestParam(value = "projectId") Long projectId,
*/
@RequestMapping(value = "/engineType", method = RequestMethod.GET)
public Message getEngineList() {
// TODO limit the engine type in exchangis
// return Message.ok().data("result", EngineTypeEnum.values());
return Message.ok().data("result", new EngineTypeEnum[]{EngineTypeEnum.SQOOP, EngineTypeEnum.DATAX});
return Message.ok().data("result", new EngineTypeEnum[]{EngineTypeEnum.DATAX});
}

/**
Expand All @@ -118,14 +117,13 @@ public Message getEngineList() {
*/
@RequestMapping(value = "/Executor", method = RequestMethod.GET)
public Message getExecutor(HttpServletRequest request) {
// String loginUser = UserUtils.getLoginUser(request);
// List<ProxyUser> proxyUsers = proxyUserService.selectByUserName(loginUser);
// if (Objects.isNull(proxyUsers) || proxyUsers.isEmpty()) {
// return Message.ok();
// }
// List<String> proxyUserNames = proxyUsers.stream().map(ProxyUser::getProxyUserName).collect(Collectors.toList());
// return Message.ok().data("result", proxyUserNames);
return null;
String loginUser = UserUtils.getLoginUser(request);
List<ProxyUser> proxyUsers = proxyUserService.selectByUserName(loginUser);
if (Objects.isNull(proxyUsers) || proxyUsers.isEmpty()) {
return Message.ok();
}
List<String> proxyUserNames = proxyUsers.stream().map(ProxyUser::getProxyUserName).collect(Collectors.toList());
return Message.ok().data("result", proxyUserNames);
}


Expand Down

0 comments on commit b68ec1f

Please sign in to comment.