Skip to content

Commit

Permalink
移除copilot相关逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexkun committed Sep 19, 2024
1 parent 127cf97 commit 8ebf01d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.webank.wedatasphere.dss.scriptis.config;

import org.apache.commons.lang.StringUtils;
import org.apache.linkis.common.conf.CommonVars;


Expand All @@ -30,21 +29,4 @@ public class DSSScriptisConfiguration {
public final static String GLOBAL_LIMITS_PREFIX = "wds.dss.scriptis.global.limits.";
public final static String GLOBAL_LIMIT_PREFIX = "wds.dss.scriptis.global.limit.";


public static final String DELIMITER_COMMA = ",";

public static final String[] GLOBAL_COPILOT_WHITELIST = CommonVars.apply("wds.dss.scriptis.copilot.whitelist", "").getValue().split(DELIMITER_COMMA);

public static final String COPILOT_ENABLE_KEY = "copilotEnable";

public static boolean isInCopilotWhiteList(String username) {
if (StringUtils.isNotBlank(username)) {
for (String name : GLOBAL_COPILOT_WHITELIST) {
if (username.equalsIgnoreCase(name)) {
return true;
}
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@

import com.webank.wedatasphere.dss.common.conf.DSSCommonConf;
import com.webank.wedatasphere.dss.common.utils.GlobalLimitsUtils;
import com.webank.wedatasphere.dss.scriptis.config.DSSScriptisConfiguration;
import com.webank.wedatasphere.dss.scriptis.service.ScriptisAuthService;
import org.apache.linkis.common.conf.BDPConfiguration;
import org.apache.linkis.server.Message;
import org.apache.linkis.server.security.SecurityFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

import static com.webank.wedatasphere.dss.scriptis.config.DSSScriptisConfiguration.GLOBAL_LIMITS_PREFIX;
Expand Down Expand Up @@ -40,12 +32,7 @@ public void init() {
public Message globalLimits(HttpServletRequest req) {
String username = SecurityFilter.getLoginUsername(req);
Map<String,Object> globalLimits = scriptisAuthService.getGlobalLimits(username);
Map<String, Object> newGlobalLimits = new HashMap<>();
newGlobalLimits.putAll(globalLimits);
if (DSSScriptisConfiguration.isInCopilotWhiteList(username)) {
newGlobalLimits.put(DSSScriptisConfiguration.COPILOT_ENABLE_KEY, true);
}
return Message.ok().data("globalLimits", newGlobalLimits);
return Message.ok().data("globalLimits", globalLimits);
}

@RequestMapping(value = "/globalLimits/{globalLimitName}",method = RequestMethod.GET)
Expand Down

0 comments on commit 8ebf01d

Please sign in to comment.