This commit is contained in:
Captain.B 2020-03-12 18:53:01 +08:00
parent f34cc6afe9
commit dd333ccbf5
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import org.apache.shiro.authc.*;
import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -49,8 +50,8 @@ public class LoginController {
// 自动选中组织工作空间 // 自动选中组织工作空间
if (StringUtils.isBlank(user.getLastOrganizationId())) { if (StringUtils.isBlank(user.getLastOrganizationId())) {
List<UserRole> userRoles = user.getUserRoles(); List<UserRole> userRoles = user.getUserRoles();
List<UserRole> test = userRoles.stream().filter(ur -> ur.getRoleId().indexOf("test") > -1).collect(Collectors.toList()); List<UserRole> test = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("test")).collect(Collectors.toList());
List<UserRole> org = userRoles.stream().filter(ur -> ur.getRoleId().indexOf("org") > -1).collect(Collectors.toList()); List<UserRole> org = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("org")).collect(Collectors.toList());
if (test.size() > 0) { if (test.size() > 0) {
String wsId = test.get(0).getSourceId(); String wsId = test.get(0).getSourceId();
userService.switchUserRole(user, "workspace", wsId); userService.switchUserRole(user, "workspace", wsId);