From dcf099691f8c8832cb9966d0be86c390ffe626dd Mon Sep 17 00:00:00 2001 From: John Niang Date: Tue, 31 Oct 2023 22:00:09 -0500 Subject: [PATCH] Fix the problem of creating PAT with hidden roles (#4800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area core /milestone 2.11.x #### What this PR does / why we need it: Fix the problem that we will encounter "insufficient roles" error while creating PAT with hidden roles. #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4783 #### Does this PR introduce a user-facing change? ```release-note 修复因部分角色导致无法正常创建个人令牌的问题 ``` --- .../run/halo/app/core/extension/service/DefaultRoleService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/core/extension/service/DefaultRoleService.java b/application/src/main/java/run/halo/app/core/extension/service/DefaultRoleService.java index 567685b4b..a9f98f0a3 100644 --- a/application/src/main/java/run/halo/app/core/extension/service/DefaultRoleService.java +++ b/application/src/main/java/run/halo/app/core/extension/service/DefaultRoleService.java @@ -54,7 +54,7 @@ public class DefaultRoleService implements RoleService { if (source.contains(SuperAdminInitializer.SUPER_ROLE_NAME)) { return Mono.just(true); } - return listDependencies(new HashSet<>(source), shouldFilterHidden(true)) + return listDependencies(new HashSet<>(source), shouldFilterHidden(false)) .map(role -> role.getMetadata().getName()) .collect(Collectors.toSet()) .map(roleNames -> roleNames.containsAll(candidates));