Browse Source

Merge branch 'develop' of gitadmin/tuoheng_oidc into release

tags/v2.4.1
xuziqing 1 year ago
parent
commit
a98f977069
1 changed files with 4 additions and 8 deletions
  1. +4
    -8
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java

+ 4
- 8
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

tenantEmploys.forEach(t -> tenantEmployMapper.deleteById(t)); tenantEmploys.forEach(t -> tenantEmployMapper.deleteById(t));
//现有list //现有list
List<ClientRoleDto> list = dto.getClientRoleDtoList(); List<ClientRoleDto> list = dto.getClientRoleDtoList();
//有集合
//有集合
List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(list); List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(list);
List<ClientRoleDto> deleteClientRoleDtoList;
//新的租户关联的平台集合
//原有集合
List<ClientRoleDto> finalClientRoleDtoList = getClientRoleDtos(clientRoleDtoList); List<ClientRoleDto> finalClientRoleDtoList = getClientRoleDtos(clientRoleDtoList);
//筛选出一样的则不做相关操作 //筛选出一样的则不做相关操作
//删除租户原始权限
deleteClientRoleDtoList = clientRoleDtos.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList());
deleteClientRoleDtoList = getClientRoleDtos(deleteClientRoleDtoList);
clientRoleDtos = clientRoleDtos.stream().filter(t -> !list.contains(t)).collect(Collectors.toList());
for (ClientRoleDto clientRoleDto : deleteClientRoleDtoList) {
//删除租户所有原始权限
for (ClientRoleDto clientRoleDto : finalClientRoleDtoList) {
clientUserRoleMapper.deleteByUserIdAndClient(tenant.getUserId(), clientRoleDto.getClientId()); clientUserRoleMapper.deleteByUserIdAndClient(tenant.getUserId(), clientRoleDto.getClientId());
authoritiesMapper.deleteByUserIdAndClient(tenant.getUserId(), clientRoleDto.getClientId()); authoritiesMapper.deleteByUserIdAndClient(tenant.getUserId(), clientRoleDto.getClientId());



Loading…
Cancel
Save