feat:(feature/REQ-3282) 删除多余代码,扩展用户角色接口支持listAuthByResourceAndRoleGroup相关功能
This commit is contained in:
parent
21be080fb3
commit
4930176eb2
@ -92,10 +92,6 @@ public class ListPermissionFromRoleGroupResp {
|
||||
|
||||
private Set<RolePermissionTagEnum> tags;
|
||||
}
|
||||
|
||||
public String buildOuWorkspaceKey() {
|
||||
return this.getOuId() + "_" + this.getWorkspaceId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -154,6 +154,16 @@ public class PageRoleUserReq {
|
||||
*/
|
||||
private Set<BatchPerson> batchPersons;
|
||||
|
||||
/**
|
||||
* 查找指定角色分组code层级下角色的用户
|
||||
*/
|
||||
private String roleGroupCode;
|
||||
|
||||
/**
|
||||
* 查找指定角色分组code层级及以下所有层级角色的用户
|
||||
*/
|
||||
private String ancestorRoleGroupCode;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
||||
@ -7,7 +7,6 @@ import cn.axzo.thrones.client.saas.ServicePkgClient;
|
||||
import cn.axzo.thrones.client.saas.entity.serivicepgkproduct.ServicePkgProduct;
|
||||
import cn.axzo.thrones.client.saas.entity.servicepkg.ServicePkgDetailRes;
|
||||
import cn.axzo.tyr.client.common.enums.RoleTypeEnum;
|
||||
import cn.axzo.tyr.client.common.enums.WorkspaceJoinType;
|
||||
import cn.axzo.tyr.client.model.enums.DelegatedType;
|
||||
import cn.axzo.tyr.client.model.enums.IdentityType;
|
||||
import cn.axzo.tyr.client.model.enums.RolePermissionTagEnum;
|
||||
@ -1043,20 +1042,6 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
||||
return featureMap;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class OUWRoleInfo {
|
||||
|
||||
Long workspaceId;
|
||||
Integer workspaceType;
|
||||
Long ouId;
|
||||
WorkspaceJoinType workspaceJoinType;
|
||||
Set<SaasRoleRes> roles = new HashSet<>();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ListIdentityFromPermissionResp> listWorkspacePermissionIdentity(WorkspacePermissionIdentityReq req) {
|
||||
|
||||
@ -1531,17 +1516,4 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
||||
.build();
|
||||
return rolePermissionCacheService.list(listRolePermissionParam);
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
static class FeatureWrapper {
|
||||
private Long featureId;
|
||||
|
||||
/**
|
||||
* 关联类型(0:saas_feature,1:saas_feature_resource)
|
||||
*/
|
||||
private Integer type;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ import cn.axzo.tyr.base.BaseTest;
|
||||
import cn.axzo.tyr.base.MysqlDataLoader;
|
||||
import cn.axzo.tyr.client.common.enums.FeatureResourceType;
|
||||
import cn.axzo.tyr.client.model.enums.IdentityType;
|
||||
import cn.axzo.tyr.client.model.req.ListPermissionFromRoleGroupReq;
|
||||
import cn.axzo.tyr.client.model.res.ListPermissionFromRoleGroupResp;
|
||||
import cn.axzo.tyr.client.model.roleuser.dto.SaasRoleUserDTO;
|
||||
import cn.axzo.tyr.client.model.roleuser.dto.SaasRoleUserV2DTO;
|
||||
import cn.axzo.tyr.client.model.roleuser.dto.SuperAminInfoResp;
|
||||
@ -24,6 +26,7 @@ import cn.axzo.tyr.feign.resp.RoleUserResp;
|
||||
import cn.axzo.tyr.server.controller.roleuser.RoleUserController;
|
||||
import cn.axzo.tyr.server.service.SaasRoleUserRelationService;
|
||||
import cn.axzo.tyr.server.service.SaasRoleUserService;
|
||||
import cn.axzo.tyr.server.service.TyrSaasAuthService;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
@ -55,6 +58,8 @@ class RoleUserV2ControllerTest extends BaseTest {
|
||||
private RoleUserController roleUserController;
|
||||
@Autowired
|
||||
private SaasRoleUserRelationService saasRoleUserRelationService;
|
||||
@Autowired
|
||||
private TyrSaasAuthService tyrSaasAuthService;
|
||||
|
||||
@BeforeEach
|
||||
@Override
|
||||
@ -1087,4 +1092,32 @@ class RoleUserV2ControllerTest extends BaseTest {
|
||||
Assertions.assertTrue(data.get(0).getRole().getRoleFeatureResources().get(0).getTags().contains(RolePermissionTagEnum.JOINED.name()));
|
||||
Assertions.assertEquals(data.get(0).getRole().getRoleFeatureResources().get(0).getTerminal(), "NT_CMS_WEB_GENERAL");
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换listAuthByResourceAndRoleGroup方法
|
||||
*/
|
||||
@Test
|
||||
void pageV2() {
|
||||
// old
|
||||
List<ListPermissionFromRoleGroupResp> listPermissionFromRoleGroupResps = tyrSaasAuthService.listAuthByResourceAndRoleGroup(ListPermissionFromRoleGroupReq.builder()
|
||||
.categoryCode("cms:zb_org_group")
|
||||
.categoryType(1)
|
||||
.build());
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.size(), 2);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getIdentityId(), 17L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getIdentityType(), 3);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getPersonId(), 3135L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getOuId(), 4L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getWorkspaceId(), 3L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getTeamOuId(), 0L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getResourceId(), 0L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getResourceType(), 0);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getRoleGroupName(), "组织架构");
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getRoleGroupCode(), "cms:zb_org_group");
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getRoleId(), 100920L);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getRoleName(), "工人管理");
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getRoleCode(), 2);
|
||||
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(0).getPermissionGroupId(), 2);
|
||||
// old
|
||||
}
|
||||
}
|
||||
@ -90,4 +90,17 @@ VALUES (101746, 'cmp:pro_team_leader_invite_recorder_0446', '班组长入场申
|
||||
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
|
||||
VALUES (101749, 'cmp:pro_team_index_0449', '查看班组详情', 4, 'NT_CMP_APP_GENERAL', 5, 101741, '636,101437,101445,101573,101741,101749,', 0, '', 0, 'cmp:pro_team_index_0449', 7, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-08-13 10:41:28', '2024-08-28 10:53:37', 86256, 25923, 0);
|
||||
|
||||
|
||||
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (369, 100920, 104, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27');
|
||||
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (370, 100921, 106, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27');
|
||||
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (372, 100923, 105, 0, '2024-09-25 11:51:58', '2024-09-26 10:43:27');
|
||||
|
||||
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
|
||||
VALUES (104, '2', '1', '组织架构', -1, -1, 14, 4, 'cms:zb_org_group', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,104,');
|
||||
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
|
||||
VALUES (105, '2', '1', '成本管理', -1, -1, 14, 5, 'cms:zb_cost_group', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,105,');
|
||||
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
|
||||
VALUES (106, '2', '1', '工人管理', -1, -1, 105, 5, 'cms:zb_cost_group', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,105,106,');
|
||||
|
||||
|
||||
#-->SaasRoleUserRelationServiceImplTest.sql
|
||||
Loading…
Reference in New Issue
Block a user