mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
fix(项目设置): 无法添加成员到工作空间共享的用户组中
--bug=1018128 --user=李玉号 【项目设置】项目成员中添加成员-该成员选择一个新建的用户组-添加不成功 https://www.tapd.cn/55049933/s/1264452
This commit is contained in:
parent
acb9a7408a
commit
cb34ba589b
@ -1255,6 +1255,10 @@ public class UserService {
|
||||
List<String> existGroupIds = this.getUserExistSourceGroup(userId, sourceId);
|
||||
toAddGroupIds.removeAll(existGroupIds);
|
||||
toAddGroupIds.retainAll(dbOptionalGroupIds);
|
||||
if (CollectionUtils.isEmpty(toAddGroupIds)) {
|
||||
LogUtil.warn("group ids not in db or not has permission, please check!");
|
||||
continue;
|
||||
}
|
||||
for (String groupId : toAddGroupIds) {
|
||||
UserGroup userGroup = new UserGroup(UUID.randomUUID().toString(), userId, groupId,
|
||||
sourceId, System.currentTimeMillis(), System.currentTimeMillis());
|
||||
@ -1280,6 +1284,12 @@ public class UserService {
|
||||
private List<String> getGroupIdsByType(String type, String sourceId) {
|
||||
// 某项目/工作空间下能查看到的用户组
|
||||
List<String> scopeList = Arrays.asList("global", sourceId);
|
||||
if (StringUtils.equals(type, "PROJECT")) {
|
||||
Project project = projectMapper.selectByPrimaryKey(sourceId);
|
||||
if (project != null) {
|
||||
scopeList = Arrays.asList("global", sourceId, project.getWorkspaceId());
|
||||
}
|
||||
}
|
||||
GroupExample groupExample = new GroupExample();
|
||||
groupExample.createCriteria().andScopeIdIn(scopeList)
|
||||
.andTypeEqualTo(type);
|
||||
|
Loading…
Reference in New Issue
Block a user