fix(Bug修复): 特色专区开通工作台后跳转403

原因:当前若用户为平台管理员但是非该组织管理员允许用户开通工作台,但是未处理该用户加入组织工作台的逻辑
处理方案:平台管理员开通工作台时自动将平台管理员也添加到组织成员中
This commit is contained in:
OTTO 2024-09-10 09:38:28 +08:00
parent d05756932a
commit 8de57146e4
2 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import com.microservices.common.core.enums.SystemRole;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.common.core.utils.html.EscapeUtil;
import com.microservices.system.api.domain.SimpleSysRole;
import com.microservices.system.api.domain.SysUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -30,6 +31,14 @@ public class GitLinkUserSimpleInfoVo
this.email = user.getString("mail");
}
public GitLinkUserSimpleInfoVo(SysUser sysUser) {
this.username = sysUser.getUserName();
this.userId = sysUser.getGitlinkUserId();
this.imageUrl = sysUser.getAvatar();
this.nickname = sysUser.getNickName();
this.email = sysUser.getEmail();
}
@ApiModelProperty(value = "用户名")
private String username;

View File

@ -225,6 +225,14 @@ public class PmsEnterpriseServiceImpl implements IPmsEnterpriseService {
List<GitLinkUserSimpleInfoVo> gitlinkUserList = pmsCommonService.getAllGitlinkUsersByOrgTeam(
pmsEnterprise.getEnterpriseIdentifier(), gitlinkOrganizationTeamVo.getId()
);
if ("owner".equalsIgnoreCase(gitlinkOrganizationTeamVo.getAuthorize())) {
boolean currentUserIsOwner = gitlinkUserList.stream().anyMatch(x -> x.getUserId().equals(SecurityUtils.getGitlinkUserId()));
if (!currentUserIsOwner) {
if (SecurityUtils.getLoginUser() != null) {
gitlinkUserList.add(new GitLinkUserSimpleInfoVo(SecurityUtils.getLoginUser().getSysUser()));
}
}
}
for (GitLinkUserSimpleInfoVo gitLinkUserSimpleInfoVo : gitlinkUserList) {
if (gitLinkUserSimpleInfoVo.getUserId() == null) {
break;