feat:优化鉴权实体,增加用户权限标记
This commit is contained in:
parent
1cc68d21b4
commit
d4d80d2d55
@ -3,6 +3,7 @@ package com.flyfish.framework.domain.authorized;
|
||||
import com.flyfish.framework.context.UserContext;
|
||||
import com.flyfish.framework.domain.base.AuditDomain;
|
||||
import com.flyfish.framework.domain.po.User;
|
||||
import com.flyfish.framework.exception.biz.InvalidBusinessException;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@ -19,8 +20,11 @@ public abstract class AuthorizedDomain extends AuditDomain {
|
||||
if (StringUtils.isNotBlank(authorizeId)) {
|
||||
return authorizeId;
|
||||
} else {
|
||||
return UserContext.sharedContext().map(UserContext::currentUser)
|
||||
.map(User::getAuthority).orElse(null);
|
||||
return UserContext.sharedContext()
|
||||
.map(UserContext::currentUser)
|
||||
.map(User::getAuthority)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.orElseThrow(() -> new InvalidBusinessException("您尚未选择所在部门!请确认您使用的部门身份!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user