Merge branch 'hotfix/REQ-20240704' into 'master'
feat:(hotfix/REQ-20240704) 鉴权和查询菜单时,如果用户没有角色,则快速返回 See merge request universal/infrastructure/backend/tyr!58
This commit is contained in:
commit
c1489d3f49
@ -4,6 +4,7 @@ import cn.axzo.framework.auth.domain.TerminalInfo;
|
||||
import cn.axzo.tyr.client.common.enums.WorkspaceJoinType;
|
||||
import cn.axzo.tyr.client.model.enums.FeatureType;
|
||||
import cn.axzo.tyr.client.model.enums.IdentityType;
|
||||
import cn.axzo.tyr.client.model.res.IdentityAuthRes;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -73,6 +74,24 @@ public class IdentityAuthReq {
|
||||
@Builder.Default
|
||||
private boolean useCache = true;
|
||||
|
||||
public IdentityAuthRes toEmpty() {
|
||||
IdentityAuthRes result = new IdentityAuthRes();
|
||||
result.setIdentity(this.getIdentityId());
|
||||
result.setIdentityType(this.getIdentityType());
|
||||
result.setPersonId(this.getPersonId());
|
||||
|
||||
List<IdentityAuthRes.WorkspacePermission> permissions = this.getWorkspaceOusPairs().stream()
|
||||
.map(workspaceOuPair -> IdentityAuthRes.WorkspacePermission.builder()
|
||||
.workspaceId(workspaceOuPair.getWorkspaceId())
|
||||
.ouId(workspaceOuPair.getOuId())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
result.setPermissions(permissions);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void distinctOUWorkspacePair() {
|
||||
if (CollectionUtil.isEmpty(this.workspaceOusPairs)) {
|
||||
return;
|
||||
|
||||
@ -59,6 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -318,6 +319,10 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
||||
//用户角色关系
|
||||
List<SaasRoleUserRelation> saasRoleUserRelations = listRoleUserRelations(identityAuthReq);
|
||||
|
||||
if (CollectionUtils.isEmpty(saasRoleUserRelations)) {
|
||||
log.warn("no user role relations found");
|
||||
return identityAuthReq.toEmpty();
|
||||
}
|
||||
|
||||
Set<Long> realWorkspaceId = saasRoleUserRelations.stream().map(SaasRoleUserRelation::getWorkspaceId).collect(Collectors.toSet());
|
||||
//工作台对应产品 key = workspaceId
|
||||
|
||||
Loading…
Reference in New Issue
Block a user