|
@ -30,11 +30,11 @@ import cn.hutool.core.util.StrUtil;
|
|
import cn.stylefeng.guns.core.consts.CommonConstant;
|
|
import cn.stylefeng.guns.core.consts.CommonConstant;
|
|
import cn.stylefeng.guns.core.consts.SymbolConstant;
|
|
import cn.stylefeng.guns.core.consts.SymbolConstant;
|
|
import cn.stylefeng.guns.core.context.login.LoginContext;
|
|
import cn.stylefeng.guns.core.context.login.LoginContext;
|
|
import cn.stylefeng.guns.sys.core.enums.AdminTypeEnum;
|
|
|
|
import cn.stylefeng.guns.core.exception.AuthException;
|
|
import cn.stylefeng.guns.core.exception.AuthException;
|
|
import cn.stylefeng.guns.core.exception.enums.AuthExceptionEnum;
|
|
import cn.stylefeng.guns.core.exception.enums.AuthExceptionEnum;
|
|
import cn.stylefeng.guns.core.pojo.login.LoginEmpInfo;
|
|
import cn.stylefeng.guns.core.pojo.login.LoginEmpInfo;
|
|
import cn.stylefeng.guns.core.pojo.login.SysLoginUser;
|
|
import cn.stylefeng.guns.core.pojo.login.SysLoginUser;
|
|
|
|
import cn.stylefeng.guns.sys.core.enums.AdminTypeEnum;
|
|
import cn.stylefeng.guns.sys.modular.auth.service.AuthService;
|
|
import cn.stylefeng.guns.sys.modular.auth.service.AuthService;
|
|
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
|
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.Authentication;
|
|
@ -56,7 +56,7 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
@Resource
|
|
@Resource
|
|
private AuthService authService;
|
|
private AuthService authService;
|
|
|
|
|
|
private LoginContextSpringSecurityImpl(){
|
|
|
|
|
|
private LoginContextSpringSecurityImpl() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@ -151,7 +151,7 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
List<String> loginUserRoleCodeList = this.getLoginUserRoleCodeList();
|
|
List<String> loginUserRoleCodeList = this.getLoginUserRoleCodeList();
|
|
String[] roleCodeArr = StrUtil.split(roleCodes, SymbolConstant.COMMA);
|
|
String[] roleCodeArr = StrUtil.split(roleCodes, SymbolConstant.COMMA);
|
|
for (String roleCode : roleCodeArr) {
|
|
for (String roleCode : roleCodeArr) {
|
|
if(loginUserRoleCodeList.contains(roleCode)) {
|
|
|
|
|
|
if (loginUserRoleCodeList.contains(roleCode)) {
|
|
flag = true;
|
|
flag = true;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@ -183,7 +183,7 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
List<String> loginUserRoleCodeList = this.getLoginUserRoleCodeList();
|
|
List<String> loginUserRoleCodeList = this.getLoginUserRoleCodeList();
|
|
String[] roleCodeArr = StrUtil.split(roleCodes, SymbolConstant.COMMA);
|
|
String[] roleCodeArr = StrUtil.split(roleCodes, SymbolConstant.COMMA);
|
|
for (String roleCode : roleCodeArr) {
|
|
for (String roleCode : roleCodeArr) {
|
|
if(!loginUserRoleCodeList.contains(roleCode)) {
|
|
|
|
|
|
if (!loginUserRoleCodeList.contains(roleCode)) {
|
|
flag = false;
|
|
flag = false;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@ -200,7 +200,7 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
private boolean isAdmin(Integer adminTypeCode) {
|
|
private boolean isAdmin(Integer adminTypeCode) {
|
|
Integer adminType = this.getSysLoginUser().getAdminType();
|
|
Integer adminType = this.getSysLoginUser().getAdminType();
|
|
boolean flag = false;
|
|
boolean flag = false;
|
|
if(adminType.equals(adminTypeCode)) {
|
|
|
|
|
|
if (adminType.equals(adminTypeCode)) {
|
|
flag = true;
|
|
flag = true;
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
@ -226,8 +226,8 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
@Override
|
|
@Override
|
|
public Long getSysLoginUserOrgId() {
|
|
public Long getSysLoginUserOrgId() {
|
|
LoginEmpInfo loginEmpInfo = this.getSysLoginUser().getLoginEmpInfo();
|
|
LoginEmpInfo loginEmpInfo = this.getSysLoginUser().getLoginEmpInfo();
|
|
if(ObjectUtil.isNotNull(loginEmpInfo)) {
|
|
|
|
if(ObjectUtil.isNotEmpty(loginEmpInfo.getOrgId())) {
|
|
|
|
|
|
if (ObjectUtil.isNotNull(loginEmpInfo)) {
|
|
|
|
if (ObjectUtil.isNotEmpty(loginEmpInfo.getOrgId())) {
|
|
return loginEmpInfo.getOrgId();
|
|
return loginEmpInfo.getOrgId();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -256,6 +256,6 @@ public class LoginContextSpringSecurityImpl implements LoginContext {
|
|
private List<String> getLoginUserRoleCodeList() {
|
|
private List<String> getLoginUserRoleCodeList() {
|
|
List<String> roleCodeList = CollectionUtil.newArrayList();
|
|
List<String> roleCodeList = CollectionUtil.newArrayList();
|
|
this.getSysLoginUser().getRoles().forEach(dict -> roleCodeList.add(dict.getStr(CommonConstant.CODE)));
|
|
this.getSysLoginUser().getRoles().forEach(dict -> roleCodeList.add(dict.getStr(CommonConstant.CODE)));
|
|
return roleCodeList;
|
|
|
|
|
|
return roleCodeList;
|
|
}
|
|
}
|
|
}
|
|
}
|