|
@@ -244,7 +244,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
|
|
sysRoleQueryWrapper.lambda().in(SysRole::getId, roleIds)
|
|
sysRoleQueryWrapper.lambda().in(SysRole::getId, roleIds)
|
|
.eq(SysRole::getEnable, true);
|
|
.eq(SysRole::getEnable, true);
|
|
List<SysRole> sysRoleList = sysRoleService.list(sysRoleQueryWrapper);
|
|
List<SysRole> sysRoleList = sysRoleService.list(sysRoleQueryWrapper);
|
|
- int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ? (int) sysRoleList.stream().filter(s -> s.getType() == RoleTypeEnum.ADMIN).count() : 0;
|
|
|
|
|
|
+ int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ? (int) sysRoleList.stream().filter(s -> RoleTypeEnum.valueOf(s.getName()) == RoleTypeEnum.ADMIN).count() : 0;
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
|
|
if (count > 0) {//超级系统管理员
|
|
if (count > 0) {//超级系统管理员
|
|
Long schoolId = (Long) ServletUtil.getRequestSchoolByNotVaild();
|
|
Long schoolId = (Long) ServletUtil.getRequestSchoolByNotVaild();
|
|
@@ -299,7 +299,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
|
|
throw ExceptionResultEnum.NOT_LOGIN.exception();
|
|
throw ExceptionResultEnum.NOT_LOGIN.exception();
|
|
}
|
|
}
|
|
for (Platform p : Platform.values()) {
|
|
for (Platform p : Platform.values()) {
|
|
- String sessionId = SessionUtil.digest(userId, Math.abs(authBean.getRoleList().stream().map(s -> s.getType()).collect(Collectors.toSet()).hashCode()), p.name());
|
|
|
|
|
|
+ String sessionId = SessionUtil.digest(userId, Math.abs(authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet()).hashCode()), p.name());
|
|
tbSessionService.removeById(sessionId);
|
|
tbSessionService.removeById(sessionId);
|
|
redisUtil.deleteUserSession(sessionId);
|
|
redisUtil.deleteUserSession(sessionId);
|
|
}
|
|
}
|
|
@@ -728,18 +728,18 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
|
|
String token = SystemConstant.getUuid();
|
|
String token = SystemConstant.getUuid();
|
|
cacheService.userCache(sysUser.getId());
|
|
cacheService.userCache(sysUser.getId());
|
|
//添加用户会话缓存
|
|
//添加用户会话缓存
|
|
- Set<String> roleName = authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet());
|
|
|
|
- String sessionId = SessionUtil.digest(sysUser.getId(), Math.abs(roleName.toString().hashCode()), platform.name());
|
|
|
|
|
|
+ Set<String> roleNames = authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet());
|
|
|
|
+ String sessionId = SessionUtil.digest(sysUser.getId(), Math.abs(roleNames.toString().hashCode()), platform.name());
|
|
//TODO 测试用
|
|
//TODO 测试用
|
|
String test = SignatureEntityTest.build(SignatureType.TOKEN, sessionId, token);
|
|
String test = SignatureEntityTest.build(SignatureType.TOKEN, sessionId, token);
|
|
ExpireTimeBean expireTime = AuthUtil.getExpireTime(platform);
|
|
ExpireTimeBean expireTime = AuthUtil.getExpireTime(platform);
|
|
- TBSession tbSession = new TBSession(sysUser.getSchoolId(), sessionId, String.valueOf(sysUser.getId()), roleName.toString(),
|
|
|
|
|
|
+ TBSession tbSession = new TBSession(sysUser.getSchoolId(), sessionId, String.valueOf(sysUser.getId()), roleNames.toString(),
|
|
platform.name(), platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token,
|
|
platform.name(), platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token,
|
|
expireTime.getDate().getTime(), appSource);
|
|
expireTime.getDate().getTime(), appSource);
|
|
tbSessionService.saveOrUpdate(tbSession);
|
|
tbSessionService.saveOrUpdate(tbSession);
|
|
redisUtil.setUserSession(sessionId, tbSession, expireTime.getExpireSeconds());
|
|
redisUtil.setUserSession(sessionId, tbSession, expireTime.getExpireSeconds());
|
|
|
|
|
|
- LoginResult loginResult = new LoginResult(sysUser, sessionId, test, roleName, appSource);
|
|
|
|
|
|
+ LoginResult loginResult = new LoginResult(sysUser, sessionId, test, roleNames, appSource);
|
|
// LoginResult loginResult = new LoginResult(sysUser, sessionId, token, roleName, appSource);
|
|
// LoginResult loginResult = new LoginResult(sysUser, sessionId, token, roleName, appSource);
|
|
loginResult.setSchoolInfo(Objects.nonNull(authBean.getSchool()) ? loginResult.new SchoolNativeBean(authBean.getSchool()) : null);
|
|
loginResult.setSchoolInfo(Objects.nonNull(authBean.getSchool()) ? loginResult.new SchoolNativeBean(authBean.getSchool()) : null);
|
|
loginResult.setOrgInfo(Objects.nonNull(authBean.getOrg()) ? loginResult.new OrgNativeBean(authBean.getOrg()) : null);
|
|
loginResult.setOrgInfo(Objects.nonNull(authBean.getOrg()) ? loginResult.new OrgNativeBean(authBean.getOrg()) : null);
|