feat(sj_1.0.0): 采用全局拦截普通用户权限为空的情况
This commit is contained in:
parent
c1071d82f4
commit
5e32dc2cd7
@ -91,7 +91,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
|
||||
|
||||
Long count = namespaceMapper.selectCount(
|
||||
new LambdaQueryWrapper<Namespace>().eq(Namespace::getUniqueId, namespaceId));
|
||||
Assert.isTrue(count > 0, () -> new SnailJobServerException("[{}] 命名空间不存在", namespaceId));
|
||||
Assert.isTrue(count > 0, () -> new SnailJobAuthenticationException("[{}] 命名空间不存在", namespaceId));
|
||||
UserSessionVO userSessionVO = new UserSessionVO();
|
||||
userSessionVO.setId(systemUser.getId());
|
||||
userSessionVO.setUsername(systemUser.getUsername());
|
||||
@ -106,7 +106,9 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
|
||||
.eq(SystemUserPermission::getSystemUserId, systemUser.getId())
|
||||
.eq(SystemUserPermission::getNamespaceId, namespaceId)
|
||||
);
|
||||
userSessionVO.setGroupNames(StreamUtils.toList(systemUserPermissions, SystemUserPermission::getGroupName));
|
||||
List<String> groupNames = StreamUtils.toList(systemUserPermissions, SystemUserPermission::getGroupName);
|
||||
Assert.notEmpty(groupNames, () -> new SnailJobAuthenticationException("用户组权限为空"));
|
||||
userSessionVO.setGroupNames(groupNames);
|
||||
}
|
||||
|
||||
httpServletRequest.setAttribute("currentUser", userSessionVO);
|
||||
|
Loading…
Reference in New Issue
Block a user