feat: (feature/REQ-2750) 1、解决组件资源更新时groupCode被覆盖成code的问题
2、解决查询项目下有权限的人无法查询出admin角色的人的问题
This commit is contained in:
parent
19ae1ee0d0
commit
784db6f298
@ -604,6 +604,11 @@ public class SaasPageElementServiceImpl extends ServiceImpl<SaasPageElementMappe
|
|||||||
// 更新关联关系的page_element_code
|
// 更新关联关系的page_element_code
|
||||||
saasPageElementFeatureResourceRelationDao.updateGroupCode(dbPageElement.getCode(), basePageElement.getCode(), dbPageElement.getTerminal());
|
saasPageElementFeatureResourceRelationDao.updateGroupCode(dbPageElement.getCode(), basePageElement.getCode(), dbPageElement.getTerminal());
|
||||||
}
|
}
|
||||||
|
// page的groupCode是自己的code,但是component的groupCode是父级页面的code
|
||||||
|
// 原来component在更新时会把自己的groupCode更新成自己的code
|
||||||
|
if (PageElementTypeEnum.COMPONENT.getCode().equals(req.getType())) {
|
||||||
|
basePageElement.setGroupCode(req.getGroupCode());
|
||||||
|
}
|
||||||
saasPageElementDao.updateById(basePageElement);
|
saasPageElementDao.updateById(basePageElement);
|
||||||
} else {
|
} else {
|
||||||
if (PageElementTypeEnum.PAGE.getCode().equals(req.getType())) {
|
if (PageElementTypeEnum.PAGE.getCode().equals(req.getType())) {
|
||||||
|
|||||||
@ -561,16 +561,6 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SaasRoleRes> listAdminRole(ListPermissionUser req) {
|
|
||||||
//超管和管理员
|
|
||||||
ListRoleReq listSaasRoleParam = ListRoleReq.builder()
|
|
||||||
.workspaceId(req.getWorkspaceId())
|
|
||||||
.ouId(req.getOuId())
|
|
||||||
.roleTypes(Lists.newArrayList(RoleTypeEnum.SUPER_ADMIN.getValue(), RoleTypeEnum.ADMIN.getValue()))
|
|
||||||
.build();
|
|
||||||
return roleService.list(listSaasRoleParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<Long> resolvePermissionAdminRole(List<SaasRoleRes> adminRoles,
|
private Set<Long> resolvePermissionAdminRole(List<SaasRoleRes> adminRoles,
|
||||||
List<ProductPermissionCacheService.PermissionDTO> productPermissions) {
|
List<ProductPermissionCacheService.PermissionDTO> productPermissions) {
|
||||||
Set<String> cooperateTypes = productPermissions.stream()
|
Set<String> cooperateTypes = productPermissions.stream()
|
||||||
@ -585,21 +575,12 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
|||||||
|
|
||||||
private Set<Long> resolvePermissionNormalRole(ListPermissionUser req,
|
private Set<Long> resolvePermissionNormalRole(ListPermissionUser req,
|
||||||
List<ProductPermissionCacheService.PermissionDTO> productPermissions,
|
List<ProductPermissionCacheService.PermissionDTO> productPermissions,
|
||||||
Set<Long> featureIds) {
|
Set<Long> featureIds,
|
||||||
|
List<SaasRoleRes> allRoles) {
|
||||||
|
|
||||||
// 因为通过权限id找对应的角色数据量巨大,所以通过找项目的角色,再找有权限的角色比较快
|
List<SaasRoleRes> normalRoles = allRoles.stream()
|
||||||
Set<Long> allRoleIds = saasRoleUserRelationMapper.listRoleIds(SaasRoleUserRelationMapper.ListRole.builder()
|
.filter(e -> !RoleTypeEnum.isAdmin(e.getRoleType()))
|
||||||
.ouId(req.getOuId())
|
.collect(Collectors.toList());
|
||||||
.workspaceId(req.getWorkspaceId())
|
|
||||||
.build());
|
|
||||||
if (CollectionUtils.isEmpty(allRoleIds)) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SaasRoleRes> normalRoles = roleService.list(RoleService.ListSaasRoleParam.builder()
|
|
||||||
.roleIds(Lists.newArrayList(allRoleIds))
|
|
||||||
.roleTypes(RoleTypeEnum.listNormal())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(normalRoles)) {
|
if (CollectionUtils.isEmpty(normalRoles)) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
@ -653,11 +634,30 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
|||||||
List<ProductPermissionCacheService.PermissionDTO> productPermissions,
|
List<ProductPermissionCacheService.PermissionDTO> productPermissions,
|
||||||
Set<Long> featureIds) {
|
Set<Long> featureIds) {
|
||||||
|
|
||||||
|
// 因为通过权限id找对应的角色数据量巨大,所以通过找项目的角色,再找有权限的角色比较快
|
||||||
|
Set<Long> allRoleIds = saasRoleUserRelationMapper.listRoleIds(SaasRoleUserRelationMapper.ListRole.builder()
|
||||||
|
.ouId(req.getOuId())
|
||||||
|
.workspaceId(req.getWorkspaceId())
|
||||||
|
.build());
|
||||||
|
if (CollectionUtils.isEmpty(allRoleIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SaasRoleRes> allRoles = roleService.list(ListRoleReq.builder()
|
||||||
|
.roleIds(Lists.newArrayList(allRoleIds))
|
||||||
|
.build());
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(allRoles)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
//超管和管理员
|
//超管和管理员
|
||||||
List<SaasRoleRes> adminRoles = listAdminRole(req);
|
List<SaasRoleRes> adminRoles = allRoles.stream()
|
||||||
|
.filter(e -> RoleTypeEnum.isAdmin(e.getRoleType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
Set<Long> adminPermissionRoleIds = resolvePermissionAdminRole(adminRoles, productPermissions);
|
Set<Long> adminPermissionRoleIds = resolvePermissionAdminRole(adminRoles, productPermissions);
|
||||||
Set<Long> normalPermissionRoleIds = resolvePermissionNormalRole(req, productPermissions, featureIds);
|
Set<Long> normalPermissionRoleIds = resolvePermissionNormalRole(req, productPermissions, featureIds, allRoles);
|
||||||
|
|
||||||
Set<Long> roleIds = Sets.newHashSet();
|
Set<Long> roleIds = Sets.newHashSet();
|
||||||
roleIds.addAll(adminPermissionRoleIds);
|
roleIds.addAll(adminPermissionRoleIds);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user