From f34cc6afe94981248291cd587aa7617ae08e85c1 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 12 Mar 2020 17:33:08 +0800 Subject: [PATCH 1/2] logback --- backend/src/main/resources/logback.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/resources/logback.xml b/backend/src/main/resources/logback.xml index b13bb97004..a90afbef37 100644 --- a/backend/src/main/resources/logback.xml +++ b/backend/src/main/resources/logback.xml @@ -145,7 +145,7 @@ - + @@ -153,7 +153,7 @@ - + From dd333ccbf5f8b56ff8b56a43b28a979f114f92f8 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 12 Mar 2020 18:53:01 +0800 Subject: [PATCH 2/2] ... --- .../main/java/io/metersphere/controller/LoginController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/LoginController.java b/backend/src/main/java/io/metersphere/controller/LoginController.java index 48f621dcc9..1b11a4abb5 100644 --- a/backend/src/main/java/io/metersphere/controller/LoginController.java +++ b/backend/src/main/java/io/metersphere/controller/LoginController.java @@ -11,6 +11,7 @@ import org.apache.shiro.authc.*; import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.subject.Subject; import org.springframework.web.bind.annotation.*; + import javax.annotation.Resource; import java.util.List; import java.util.stream.Collectors; @@ -49,8 +50,8 @@ public class LoginController { // 自动选中组织,工作空间 if (StringUtils.isBlank(user.getLastOrganizationId())) { List userRoles = user.getUserRoles(); - List test = userRoles.stream().filter(ur -> ur.getRoleId().indexOf("test") > -1).collect(Collectors.toList()); - List org = userRoles.stream().filter(ur -> ur.getRoleId().indexOf("org") > -1).collect(Collectors.toList()); + List test = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("test")).collect(Collectors.toList()); + List org = userRoles.stream().filter(ur -> ur.getRoleId().startsWith("org")).collect(Collectors.toList()); if (test.size() > 0) { String wsId = test.get(0).getSourceId(); userService.switchUserRole(user, "workspace", wsId);