Browse Source

code

master
jiangxiaopeng 1 year ago
parent
commit
74662933c0
1 changed files with 114 additions and 0 deletions
  1. +114
    -0
      src/main/java/com/whn/hellospring/service/GitlabService.java

+ 114
- 0
src/main/java/com/whn/hellospring/service/GitlabService.java View File

@ -189,6 +189,120 @@ public class GitlabService {
return true; return true;
} }
/**
* 查询一个组中的用户
* @param groupId 组id
* @param userId 用户id
* @return 没报错则返回true
*/
@SneakyThrows
public Member getMemberFromGroup(Integer groupId, Integer userId){
Member member = gitLabApi.getGroupApi().getMember(10, 10);
return member;
}
/**
* 将用户添加到组
* @param groupId 组id
* @param userId 用户id
* @param accessLevel 权限级别
* @return 没报错则返回true
*/
@SneakyThrows
public boolean addMemberToGroup(Integer groupId, Integer userId, AccessLevel accessLevel){
gitLabApi.getGroupApi().addMember(10, 10, accessLevel);
return true;
}
/**
* 更新组内用户的权限
* @param groupId 组id
* @param userId 用户id
* @param accessLevel 权限级别
* @return 没报错则返回true
*/
@SneakyThrows
public boolean updateMemberInGroup(Integer groupId, Integer userId, AccessLevel accessLevel){
gitLabApi.getGroupApi().updateMember(groupId, userId, accessLevel);
return true;
}
/**
* 将用户移出一个组
* @param groupId 组id
* @param userId 用户id
* @return 没报错则返回true
*/
@SneakyThrows
public boolean removeMemberInGroup(Integer groupId, Integer userId){
gitLabApi.getGroupApi().removeMember(groupId, userId);
return true;
}
/**
* 查询一个项目中的用户
* @param projectId 项目id
* @param userId 用户id
* @return 没报错则返回true
*/
@SneakyThrows
public Member getMemberFromProject(Integer projectId, Integer userId){
Member member = gitLabApi.getProjectApi().getMember(10, 10);
return member;
}
/**
* 将用户添加到项目
* @param projectId 项目id
* @param userId 用户id
* @param accessLevel 权限级别
* @return 没报错则返回true
*/
@SneakyThrows
public boolean addMemberToProject(Integer projectId, Integer userId, AccessLevel accessLevel){
gitLabApi.getProjectApi().addMember(10, 10, accessLevel);
return true;
}
/**
* 更新项目内用户的权限
* @param projectId 项目id
* @param userId 用户id
* @param accessLevel 权限级别
* @return 没报错则返回true
*/
@SneakyThrows
public boolean updateMemberInProject(Integer projectId, Integer userId, AccessLevel accessLevel){
gitLabApi.getProjectApi().updateMember(projectId, userId, accessLevel);
return true;
}
/**
* 将用户移出一个项目
* @param projectId 项目id
* @param userId 用户id
* @return 没报错则返回true
*/
@SneakyThrows
public boolean removeMemberInProject(Integer projectId, Integer userId){
gitLabApi.getProjectApi().removeMember(projectId, userId);
return true;
}
/**
* 更新一个项目的访问级别
* @param projectId 项目id
* @param visibility 访问级别枚举
* @return 没有出异常返回true
*/
@SneakyThrows
public boolean updateProjectVisibility(Integer projectId, Visibility visibility){
Project project = new Project();
project.setId(projectId);
project.setVisibility(visibility);
gitLabApi.getProjectApi().updateProject(project);
return true;
}
/** /**
* 会获取分支下所有的文件如果文件很多则消耗时间较多尽量不使用这个方法 * 会获取分支下所有的文件如果文件很多则消耗时间较多尽量不使用这个方法


Loading…
Cancel
Save