Skip to content

Commit

Permalink
feat:增加人员模板操作相关接口 TencentBlueKing#89
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Jan 25, 2024
1 parent 28c8084 commit e71e1dc
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ext {
set('lombokVersion', '1.18.10')
set("junitVersion", "5.4.2")

String iamVersion = (System.getProperty("iamVersion") ?: "1.0.44")
String iamVersion = (System.getProperty("iamVersion") ?: "1.0.45")
if (System.getProperty("snapshot") == "true") {
set('iamVersion', iamVersion + "-SNAPSHOT")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public enum ManagerScopesEnum {
* 组织
*/
DEPARTMENT("department"),
/**
* 人员模板
*/
TEMPLATE("template"),
/**
* 所有类型
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class V2IamUri {
public static final String V2_VERIFY_GROUP_VALID_DEPARTMENT = "/api/v2/open/management/systems/%s/departments/%s/groups/belong/?group_ids=%s";
public static final String V2_SUBSET_GRADE_MANAGER_GROUP_GET = "/api/v2/open/management/systems/%s/subset_managers/%s/groups/";
public static final String V2_MANAGER_GRADE_GROUP_GET = "/api/v2/open/management/systems/%s/grade_managers/%s/groups/";
public static final String V2_MANAGER_GRADE_TEMPLATE_GET = "api/v2/open/management/systems/%s/grade_managers/%s/subject_templates/";

// 创建分级管理员
public static final String V2_MANAGER_ROLE_CREATE = "/api/v2/open/management/systems/%s/grade_managers/";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tencent.bk.sdk.iam.dto.manager;

import com.fasterxml.jackson.annotation.JsonProperty;

public class SubjectTemplateInfo {
private Integer id;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 是否是只读人员模版
*/
private Boolean readonly;
/**
* 来源用户组ID
*/
@JsonProperty("source_group_id")
private Integer sourceGroupId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.tencent.bk.sdk.iam.dto.manager.dto;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class SearchTemplatesDTO {
/**
* 人员模板名称
*/
String name;
/**
* 人员模版id筛选
*/
String id;
/**
* 描述
*/
String description;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.tencent.bk.sdk.iam.dto.manager.vo;

import com.tencent.bk.sdk.iam.dto.manager.SubjectTemplateInfo;

import java.util.List;

public class SubjectTemplateVO {
int count;
List<SubjectTemplateInfo> results;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.tencent.bk.sdk.iam.dto.CallbackApplicationDTO;
import com.tencent.bk.sdk.iam.dto.GradeManagerApplicationCreateDTO;
import com.tencent.bk.sdk.iam.dto.GradeManagerApplicationUpdateDTO;
import com.tencent.bk.sdk.iam.dto.PageInfoDTO;
import com.tencent.bk.sdk.iam.dto.V2PageInfoDTO;
import com.tencent.bk.sdk.iam.dto.action.GroupAction;
import com.tencent.bk.sdk.iam.dto.application.ApplicationDTO;
Expand All @@ -28,9 +27,11 @@
import com.tencent.bk.sdk.iam.dto.manager.dto.ManagerMemberGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.ManagerRoleGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.SearchGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.SearchTemplatesDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.UpdateManagerDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.UpdateSubsetManagerDTO;
import com.tencent.bk.sdk.iam.dto.manager.vo.ManagerGroupMemberVo;
import com.tencent.bk.sdk.iam.dto.manager.vo.SubjectTemplateVO;
import com.tencent.bk.sdk.iam.dto.manager.vo.V2ManagerRoleGroupVO;
import com.tencent.bk.sdk.iam.dto.response.CallbackApplicationResponese;
import com.tencent.bk.sdk.iam.dto.response.GradeManagerApplicationResponse;
Expand Down Expand Up @@ -93,6 +94,11 @@ public interface V2ManagerService {
*/
public V2ManagerRoleGroupVO getGradeManagerRoleGroupV2(String gradeManagerId, SearchGroupDTO searchGroupDTO, V2PageInfoDTO pageInfoDTO);

/**
* 查询分级管理员下人员模板列表
*/
public SubjectTemplateVO getGradeManagerRoleTemplate(String gradeManagerId, SearchTemplatesDTO searchTemplatesDTO, V2PageInfoDTO pageInfoDTO);

/**
* 创建分级管理员申请
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
import com.tencent.bk.sdk.iam.dto.manager.dto.ManagerMemberGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.ManagerRoleGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.SearchGroupDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.SearchTemplatesDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.UpdateManagerDTO;
import com.tencent.bk.sdk.iam.dto.manager.dto.UpdateSubsetManagerDTO;
import com.tencent.bk.sdk.iam.dto.manager.vo.CreateVo;
import com.tencent.bk.sdk.iam.dto.manager.vo.ManagerGroupMemberVo;
import com.tencent.bk.sdk.iam.dto.manager.vo.SubjectTemplateVO;
import com.tencent.bk.sdk.iam.dto.manager.vo.V2ManagerRoleGroupVO;
import com.tencent.bk.sdk.iam.dto.response.CallbackApplicationResponese;
import com.tencent.bk.sdk.iam.dto.response.GradeManagerApplicationResponse;
Expand Down Expand Up @@ -536,6 +538,38 @@ public V2ManagerRoleGroupVO getGradeManagerRoleGroupV2(String gradeManagerId, Se
return null;
}

@Override
public SubjectTemplateVO getGradeManagerRoleTemplate(String gradeManagerId, SearchTemplatesDTO searchTemplatesDTO, V2PageInfoDTO pageInfoDTO) {
try {
AuthRequestContext.setRequestName("V2_MANAGER_GRADE_TEMPLATE_GET");
String url = v2BuildURLPage(String.format(V2IamUri.V2_MANAGER_GRADE_TEMPLATE_GET, iamConfiguration.getSystemId(), gradeManagerId), pageInfoDTO);
if (searchTemplatesDTO != null) {
String s = HttpUtils.joinParams(searchTemplatesDTO);
if (StringUtils.isNotBlank(s))
url = url.concat("&".concat(s));
}
String responseStr = apigwHttpClientService.doHttpGet(url);
if (StringUtils.isNotBlank(responseStr)) {
log.debug("get grade manager role template response|{}", responseStr);
ResponseDTO<SubjectTemplateVO> responseInfo =
JsonUtil.fromJson(responseStr, new TypeReference<ResponseDTO<SubjectTemplateVO>>() {
});
if (responseInfo != null) {
ResponseUtil.checkResponse(responseInfo);
return responseInfo.getData();
}
} else {
log.warn("get grade manager role template response got empty response!");
}
} catch (IamException iamException) {
throw iamException;
} catch (Exception e) {
log.error("get grade manager role template response failed", e);
throw new RuntimeException(e);
}
return null;
}

@Override
public GradeManagerApplicationResponse createGradeManagerApplication(GradeManagerApplicationCreateDTO gradeManagerApplicationCreateDTO) {
try {
Expand Down

0 comments on commit e71e1dc

Please sign in to comment.