From 113ad0eb434f19c00ebc95b229dfe677993d2b3a Mon Sep 17 00:00:00 2001 From: zhansihu Date: Wed, 17 Jan 2024 15:15:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(auth):=20=E4=BF=AE=E5=A4=8DSQL=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/service/impl/TyrSaasAuthServiceImpl.java | 10 ++++++---- .../src/main/resources/mapper/SaasRoleMapper.xml | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index 6ef200e3..b7d9a015 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -744,9 +744,10 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { List superAdmins = roleService.listSuperAdminByWorkspace(Collections.singletonList(req.getWorkspaceId())); for (SaasRoleWithUser superAdmin : superAdmins) { Set distinctSet = distinctMap.getOrDefault(superAdmin.getOuId(), new HashSet<>()); - boolean exist = distinctSet.add(superAdmin.getIdentityId() + "-" + superAdmin.getIdentityType()); + boolean suc = distinctSet.add(superAdmin.getIdentityId() + "-" + superAdmin.getIdentityType()); distinctMap.put(superAdmin.getOuId(), distinctSet); - if (exist) { + if (!suc) { + log.info("duplicate identity:{}, identityType:{}", superAdmin.getIdentityId(), superAdmin.getIdentityType()); continue; } ListIdentityFromPermissionResp resp = result.getOrDefault(superAdmin.getOuId(), new ListIdentityFromPermissionResp()); @@ -779,9 +780,10 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { for (SaasRoleUserRelation relation : relations) { Set distinctSet = distinctMap.getOrDefault(relation.getOuId(), new HashSet<>()); - boolean exist = distinctSet.add(relation.getIdentityId() + "-" + relation.getIdentityType()); + boolean suc = distinctSet.add(relation.getIdentityId() + "-" + relation.getIdentityType()); distinctMap.put(relation.getOuId(), distinctSet); - if (exist) { + if (!suc) { + log.info("duplicate identity:{}, identityType:{}", relation.getIdentityId(), relation.getIdentityType()); continue; } diff --git a/tyr-server/src/main/resources/mapper/SaasRoleMapper.xml b/tyr-server/src/main/resources/mapper/SaasRoleMapper.xml index 7f3e8c9b..0ac1923c 100644 --- a/tyr-server/src/main/resources/mapper/SaasRoleMapper.xml +++ b/tyr-server/src/main/resources/mapper/SaasRoleMapper.xml @@ -119,7 +119,10 @@ FROM saas_pgroup_permission_relation pg, saas_pgroup_role_relation rg, saas_role r WHERE pg.is_delete = 0 AND rg.is_delete = 0 AND r.is_delete = 0 AND pg.group_id = rg.group_id AND rg.role_id = r.id - AND pg.feature_id IN (#{featureIds}) + AND pg.feature_id IN + + #{item, jdbcType=NUMERIC} + \ No newline at end of file