fix(系统设置): OAuth2用户禁用问题

--bug=1020043 --user=李玉号 【系统设置】OAuth2禁用失败
https://www.tapd.cn/55049933/s/1302563
This commit is contained in:
shiziyuan9527 2022-11-23 13:42:22 +08:00 committed by lyh
parent 36fb8c7cfc
commit 51129644e3
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import io.metersphere.base.domain.AuthSource; import io.metersphere.base.domain.AuthSource;
import io.metersphere.base.domain.User; import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.UserSource; import io.metersphere.commons.constants.UserSource;
import io.metersphere.commons.constants.UserStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
@ -307,6 +308,9 @@ public class SSOService {
if (!StringUtils.equals(u.getSource(), UserSource.OAuth2.name())) { if (!StringUtils.equals(u.getSource(), UserSource.OAuth2.name())) {
MSException.throwException("user already exist, user source type is " + u.getSource()); MSException.throwException("user already exist, user source type is " + u.getSource());
} }
if (StringUtils.equals(u.getStatus(), UserStatus.DISABLED)) {
MSException.throwException("user is disabled!");
}
} }
LoginRequest loginRequest = new LoginRequest(); LoginRequest loginRequest = new LoginRequest();