review code.
This commit is contained in:
@@ -50,8 +50,8 @@ public class AuthenticationController {
|
||||
return UserLoginVO.builder().token(token).build();
|
||||
}
|
||||
|
||||
@IgnoreLog
|
||||
@PermitAll
|
||||
@IgnoreLog
|
||||
@Operation(summary = "登出")
|
||||
@GetMapping("/logout")
|
||||
public HttpWrapper<?> logout(HttpServletRequest servletRequest) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.lang.define.wrapper.HttpWrapper;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||
import com.orion.ops.module.infra.entity.request.user.*;
|
||||
import com.orion.ops.module.infra.entity.vo.SystemUserVO;
|
||||
import com.orion.ops.module.infra.service.SystemUserRoleService;
|
||||
@@ -56,7 +57,7 @@ public class SystemUserController {
|
||||
return systemUserService.updateSystemUser(request);
|
||||
}
|
||||
|
||||
// TODO 修改头像
|
||||
// TODO 修改头像 最后再说 可有可无的功能 要是有 http 文件需求就写
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "修改用户状态")
|
||||
@@ -86,7 +87,7 @@ public class SystemUserController {
|
||||
return HttpWrapper.ok();
|
||||
}
|
||||
|
||||
@IgnoreLog
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询用户")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@@ -95,7 +96,7 @@ public class SystemUserController {
|
||||
return systemUserService.getSystemUser(id);
|
||||
}
|
||||
|
||||
@IgnoreLog
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询所有用户")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user:query')")
|
||||
@@ -103,7 +104,7 @@ public class SystemUserController {
|
||||
return systemUserService.getSystemUserList();
|
||||
}
|
||||
|
||||
@IgnoreLog
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询用户")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user:query')")
|
||||
|
||||
@@ -30,6 +30,7 @@ import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 权限服务
|
||||
@@ -153,11 +154,20 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 查询角色菜单
|
||||
List<SystemMenuVO> menus = roles.stream()
|
||||
.map(roleMenuCache::get)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
.distinct()
|
||||
Stream<SystemMenuCacheDTO> mergeStream;
|
||||
if (RoleDefine.containsAdmin(roles)) {
|
||||
// 管理员拥有全部权限
|
||||
mergeStream = menuCache.stream();
|
||||
} else {
|
||||
// 当前用户所适配的角色
|
||||
mergeStream = roles.stream()
|
||||
.map(roleMenuCache::get)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
.distinct();
|
||||
}
|
||||
// 状态过滤
|
||||
List<SystemMenuVO> menus = mergeStream
|
||||
.filter(s -> MenuStatusEnum.ENABLED.getStatus().equals(s.getStatus()))
|
||||
.filter(s -> !MenuTypeEnum.FUNCTION.getType().equals(s.getType()))
|
||||
.map(SystemMenuConvert.MAPPER::to)
|
||||
|
||||
Reference in New Issue
Block a user