Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev-1.8.0' into dev-1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qweqnotallow committed Sep 18, 2024
2 parents 858a167 + 51f952f commit 76f59a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,10 @@ public void transferProject(ProjectTransferRequest projectTransferRequest, DSSPr
initProjectModifyRequest(projectModifyRequest,projectTransferRequest, oldProjectOwner);

String newProjectOwner = projectTransferRequest.getTransferUserName();
if (!dssWorkspaceUserService.getUserRoleByUserName(newProjectOwner).isEmpty()) {
Long count = dssWorkspaceUserService.getCountByUsername(newProjectOwner, (int)workspace.getWorkspaceId());
if (count == null || count == 0) {
dssUserService.insertIfNotExist(newProjectOwner, workspace);
List<Integer> roles = Collections.singletonList(3);
List<Integer> roles = Collections.singletonList(4);
dssWorkspaceUserService.addWorkspaceUser(roles, workspace.getWorkspaceId(), newProjectOwner, "system",
null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;

import static com.webank.wedatasphere.dss.framework.common.conf.TokenConf.HPMS_USER_TOKEN;
Expand Down Expand Up @@ -216,19 +214,25 @@ public Message listAllUsers() {

/**
* 判断username是否离职
* @param username
* @param usernames
* @return 离职返回true,未离职false
*/
@RequestMapping(path = "isDismissed", method = RequestMethod.GET)
public Message isDismissed(String username) {
boolean isDismissed;
if(username.startsWith("hduser")||username.startsWith("WTSS_")){
isDismissed = false;
}else{
StaffInfo staffInfo= staffInfoGetter.getStaffInfoByUsername(username);
isDismissed = staffInfo != null && "2".equals(staffInfo.getStatus());
@RequestMapping(path = "isDismissed", method = RequestMethod.POST)
public Message isDismissed(@RequestBody Map<String, List<String>> body) {
List<String> usernames = body.get("usernames");
List<Map<String, Boolean>> userStatus = new ArrayList<>(usernames.size());
for (String username : usernames) {
boolean isDismissed;
if(username.startsWith("hduser")||username.startsWith("WTSS_")){
isDismissed = false;
}else{
StaffInfo staffInfo= staffInfoGetter.getStaffInfoByUsername(username);
isDismissed = staffInfo != null && "2".equals(staffInfo.getStatus());
}
Map<String, Boolean> tuple=Collections.singletonMap(username, isDismissed);
userStatus.add(tuple);
}
return Message.ok().data("isDismissed", isDismissed);
return Message.ok().data("isDismissed", userStatus);
}

@RequestMapping(path = "getWorkspaceIdByUserName", method = RequestMethod.GET)
Expand Down

0 comments on commit 76f59a4

Please sign in to comment.