From eb9a155efcafc6ee2e76a09a00f53e23d1c20c95 Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:18:10 +0800 Subject: [PATCH 1/3] feat(web api): query subject group details (#303) * feat(web api): query subject group details --- pkg/abac/pap/group.go | 68 +++++++++++++++++++++++ pkg/abac/pap/group_test.go | 89 ++++++++++++++++++++++++++++++ pkg/abac/pap/mock/group.go | 15 +++++ pkg/api/model/handler/action.go | 2 - pkg/api/model/handler/query.go | 2 - pkg/api/web/handler/group.go | 32 +++++++++++ pkg/api/web/handler/subject_slz.go | 6 ++ pkg/api/web/router.go | 3 + pkg/service/group.go | 32 +++++++++++ pkg/service/mock/group.go | 15 +++++ 10 files changed, 260 insertions(+), 4 deletions(-) diff --git a/pkg/abac/pap/group.go b/pkg/abac/pap/group.go index 9ce9d523..f39689b1 100644 --- a/pkg/abac/pap/group.go +++ b/pkg/abac/pap/group.go @@ -45,6 +45,7 @@ type GroupController interface { _type, id, systemID string, beforeExpiredAt, limit, offset int64, ) ([]SubjectGroup, error) ListGroupSubjectBeforeExpiredAtBySubjects(subjects []Subject, expiredAt int64) ([]GroupSubject, error) + ListSubjectGroupDetails(_type, id string, groupIDs []string) ([]SubjectGroup, error) CheckSubjectEffectGroups(_type, id string, groupIDs []string) (map[string]map[string]interface{}, error) GetGroupMemberCount(_type, id string) (int64, error) @@ -169,6 +170,73 @@ func (c *groupController) ListGroupSubjectBeforeExpiredAtBySubjects( return relations, nil } +func (c *groupController) ListSubjectGroupDetails(_type, id string, groupIDs []string) ([]SubjectGroup, error) { + errorWrapf := errorx.NewLayerFunctionErrorWrapf(GroupCTL, "ListSubjectGroupDetails") + + // subject Type+ID to PK + subjectPK, err := cacheimpls.GetLocalSubjectPK(_type, id) + if err != nil { + return nil, errorWrapf(err, "cacheimpls.GetLocalSubjectPK _type=`%s`, id=`%s` fail", _type, id) + } + + groupPKToID := make(map[int64]string, len(groupIDs)) + groupPKs := make([]int64, 0, len(groupIDs)) + for _, groupID := range groupIDs { + // if groupID is empty, skip + if groupID == "" { + continue + } + + // get the groupPK via groupID + groupPK, err := cacheimpls.GetLocalSubjectPK(types.GroupType, groupID) + if err != nil { + if errors.Is(err, sql.ErrNoRows) { + log.WithError(err).Debugf("cacheimpls.GetSubjectPK type=`group`, id=`%s` fail", groupID) + continue + } + + return nil, errorWrapf( + err, + "cacheimpls.GetSubjectPK _type=`%s`, id=`%s` fail", + types.GroupType, + groupID, + ) + } + + groupPKs = append(groupPKs, groupPK) + groupPKToID[groupPK] = groupID + } + + // NOTE: if the performance is a problem, change this to a local cache, key: subjectPK, value int64Set + svcSubjectGroups, err := c.service.ListSubjectGroupsBySubjectPKGroupPKs(subjectPK, groupPKs) + if err != nil { + return nil, errorWrapf( + err, + "service.ListSubjectGroupsBySubjectPKGroupPKs subjectPKs=`%d`, groupPKs=`%+v` fail", + subjectPK, + groupPKs, + ) + } + + groups := make([]SubjectGroup, 0, len(svcSubjectGroups)) + for _, m := range svcSubjectGroups { + groupID, ok := groupPKToID[m.GroupPK] + if !ok { + continue + } + + groups = append(groups, SubjectGroup{ + PK: m.PK, + Type: types.GroupType, + ID: groupID, + ExpiredAt: m.ExpiredAt, + CreatedAt: m.CreatedAt, + }) + } + + return groups, nil +} + func (c *groupController) CheckSubjectEffectGroups( _type, id string, groupIDs []string, diff --git a/pkg/abac/pap/group_test.go b/pkg/abac/pap/group_test.go index 100298db..5fd9b9d8 100644 --- a/pkg/abac/pap/group_test.go +++ b/pkg/abac/pap/group_test.go @@ -354,6 +354,95 @@ var _ = Describe("GroupController", func() { }) }) + Describe("ListSubjectGroupDetails", func() { + var ctl *gomock.Controller + var patches *gomonkey.Patches + BeforeEach(func() { + ctl = gomock.NewController(GinkgoT()) + + patches = gomonkey.ApplyFunc(cacheimpls.GetLocalSubjectPK, func(_type, id string) (pk int64, err error) { + if _type == "user" && id == "1" { + return int64(1), nil + } + if _type == "user" && id == "2" { + return int64(2), nil + } + if _type == "group" && id == "10" { + return int64(10), nil + } + + if _type == "group" && id == "20" { + return int64(20), nil + } + + return 0, sql.ErrNoRows + }) + + patches.ApplyFunc(cacheimpls.GetSubjectDepartmentPKs, func(subjectPK int64) ([]int64, error) { + return []int64{10, 20, 30}, nil + }) + }) + AfterEach(func() { + ctl.Finish() + patches.Reset() + }) + + It("get user subject PK fail", func() { + c := &groupController{ + service: mock.NewMockGroupService(ctl), + } + + _, err := c.ListSubjectGroupDetails("user", "notexist", []string{"10", "20"}) + assert.Error(GinkgoT(), err) + assert.Contains(GinkgoT(), err.Error(), "cacheimpls.GetLocalSubjectPK") + }) + It("get subject all group pks fail", func() { + mockGroupService := mock.NewMockGroupService(ctl) + mockGroupService.EXPECT().ListSubjectGroupsBySubjectPKGroupPKs(gomock.Any(), gomock.Any()).Return( + nil, errors.New("error"), + ).AnyTimes() + + c := &groupController{ + service: mockGroupService, + } + + _, err := c.ListSubjectGroupDetails("user", "1", []string{"10", "20"}) + + assert.Error(GinkgoT(), err) + assert.Contains(GinkgoT(), err.Error(), "ListSubjectGroupsBySubjectPKGroupPKs") + }) + + It("ok, all groupID valid", func() { + mockGroupService := mock.NewMockGroupService(ctl) + mockGroupService.EXPECT().ListSubjectGroupsBySubjectPKGroupPKs(gomock.Any(), gomock.Any()).Return( + []types.SubjectGroup{{ + PK: 1, + GroupPK: 10, + ExpiredAt: 1, + CreatedAt: time.Time{}, + }, { + PK: 2, + GroupPK: 20, + ExpiredAt: 1, + CreatedAt: time.Time{}, + }}, nil, + ).AnyTimes() + + c := &groupController{ + service: mockGroupService, + } + + groups, err := c.ListSubjectGroupDetails("user", "1", []string{"10", "20"}) + assert.NoError(GinkgoT(), err) + assert.Len(GinkgoT(), groups, 2) + assert.Equal(GinkgoT(), groups[0].PK, int64(1)) + assert.Equal(GinkgoT(), groups[0].ID, "10") + assert.Equal(GinkgoT(), groups[1].PK, int64(2)) + assert.Equal(GinkgoT(), groups[1].ID, "20") + + }) + }) + Describe("CheckSubjectExistGroups", func() { var ctl *gomock.Controller var patches *gomonkey.Patches diff --git a/pkg/abac/pap/mock/group.go b/pkg/abac/pap/mock/group.go index 1286628d..f8152461 100644 --- a/pkg/abac/pap/mock/group.go +++ b/pkg/abac/pap/mock/group.go @@ -333,6 +333,21 @@ func (mr *MockGroupControllerMockRecorder) ListRbacGroupByResource(systemID, res return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRbacGroupByResource", reflect.TypeOf((*MockGroupController)(nil).ListRbacGroupByResource), systemID, resource) } +// ListSubjectGroupDetails mocks base method. +func (m *MockGroupController) ListSubjectGroupDetails(_type, id string, groupIDs []string) ([]pap.SubjectGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSubjectGroupDetails", _type, id, groupIDs) + ret0, _ := ret[0].([]pap.SubjectGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSubjectGroupDetails indicates an expected call of ListSubjectGroupDetails. +func (mr *MockGroupControllerMockRecorder) ListSubjectGroupDetails(_type, id, groupIDs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSubjectGroupDetails", reflect.TypeOf((*MockGroupController)(nil).ListSubjectGroupDetails), _type, id, groupIDs) +} + // UpdateGroupMembersExpiredAt mocks base method. func (m *MockGroupController) UpdateGroupMembersExpiredAt(_type, id string, members []pap.GroupMember) error { m.ctrl.T.Helper() diff --git a/pkg/api/model/handler/action.go b/pkg/api/model/handler/action.go index a2a3ff85..7f27548f 100644 --- a/pkg/api/model/handler/action.go +++ b/pkg/api/model/handler/action.go @@ -123,7 +123,6 @@ func BatchCreateActions(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions/{action_id} [put] func UpdateAction(c *gin.Context) { systemID := c.Param("system_id") @@ -256,7 +255,6 @@ func UpdateAction(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions/{action_id} [delete] func DeleteAction(c *gin.Context) { systemID := c.Param("system_id") actionID := c.Param("action_id") diff --git a/pkg/api/model/handler/query.go b/pkg/api/model/handler/query.go index 3216be33..d6be5fd2 100644 --- a/pkg/api/model/handler/query.go +++ b/pkg/api/model/handler/query.go @@ -45,8 +45,6 @@ const ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/query [get] -// //nolint:gocognit func SystemInfoQuery(c *gin.Context) { var query querySerializer diff --git a/pkg/api/web/handler/group.go b/pkg/api/web/handler/group.go index 7284cdfe..69c0466d 100644 --- a/pkg/api/web/handler/group.go +++ b/pkg/api/web/handler/group.go @@ -111,6 +111,38 @@ func ListSubjectGroups(c *gin.Context) { }) } +// QuerySubjectGroupsDetail ... +func QuerySubjectGroupsDetail(c *gin.Context) { + var query querySubjectGroupsDetailSerializer + if err := c.ShouldBindQuery(&query); err != nil { + util.BadRequestErrorJSONResponse(c, util.ValidationErrorMessage(err)) + return + } + // input: subject.type= & subject.id= & group_ids=1,2,3,4 + // output: 个人或部门 直接加入的每个用户组里的详情(包括过期时间、创建时间) + groupIDs := strings.Split(query.GroupIDs, ",") + if len(groupIDs) > 100 { + util.BadRequestErrorJSONResponse(c, "group_ids should be less than 100") + return + } + + ctl := pap.NewGroupController() + subjectGroups, err := ctl.ListSubjectGroupDetails(query.Type, query.ID, groupIDs) + if err != nil { + err = errorx.Wrapf( + err, + "Handler", + "ctl.ListSubjectGroupDetails type=`%s`, id=`%s` fail", + query.Type, + query.ID, + ) + util.SystemErrorJSONResponse(c, err) + return + } + + util.SuccessJSONResponse(c, "ok", subjectGroups) +} + // CheckSubjectGroupsBelong ... func CheckSubjectGroupsBelong(c *gin.Context) { var query checkSubjectGroupsBelongSerializer diff --git a/pkg/api/web/handler/subject_slz.go b/pkg/api/web/handler/subject_slz.go index bf8e3d1c..67a29a24 100644 --- a/pkg/api/web/handler/subject_slz.go +++ b/pkg/api/web/handler/subject_slz.go @@ -51,6 +51,12 @@ type listGroupMemberSerializer struct { pageSerializer } +type querySubjectGroupsDetailSerializer struct { + Type string `form:"type" binding:"required,oneof=user department"` + ID string `form:"id" binding:"required"` + GroupIDs string `form:"group_ids" binding:"required"` +} + type checkSubjectGroupsBelongSerializer struct { Type string `form:"type" binding:"required,oneof=user department"` ID string `form:"id" binding:"required"` diff --git a/pkg/api/web/router.go b/pkg/api/web/router.go index 13bcc49f..e306d07f 100644 --- a/pkg/api/web/router.go +++ b/pkg/api/web/router.go @@ -134,6 +134,9 @@ func Register(r *gin.RouterGroup) { // 带分页 https://github.com/TencentBlueKing/bk-iam-saas/issues/1155 r.GET("/subject-groups", handler.ListSubjectGroups) + // subject-groups/detail?type=user&id=tome&groups=1,2,3,4,5 + r.GET("/subjects-groups/detail", handler.QuerySubjectGroupsDetail) + // add subject-groups?type=user&id=tome&groups=1,2,3,4,5 r.GET("/subjects-groups/belong", handler.CheckSubjectGroupsBelong) diff --git a/pkg/service/group.go b/pkg/service/group.go index 6225736e..d24e36ef 100644 --- a/pkg/service/group.go +++ b/pkg/service/group.go @@ -47,6 +47,10 @@ type GroupService interface { ListPagingSubjectSystemGroups( subjectPK int64, systemID string, beforeExpiredAt, limit, offset int64, ) ([]types.SubjectGroup, error) + ListSubjectGroupsBySubjectPKGroupPKs( + subjectPK int64, + groupPKs []int64, + ) ([]types.SubjectGroup, error) ListEffectSubjectGroupsBySubjectPKGroupPKs( subjectPK int64, groupPKs []int64, @@ -289,6 +293,34 @@ func (l *groupService) ListGroupSubjectBeforeExpiredAtByGroupPKs( return convertToGroupSubjects(daoRelations), nil } +func (l *groupService) ListSubjectGroupsBySubjectPKGroupPKs( + subjectPK int64, + groupPKs []int64, +) (subjectGroups []types.SubjectGroup, err error) { + errorWrapf := errorx.NewLayerFunctionErrorWrapf(GroupSVC, "ListSubjectGroupsBySubjectPKGroupPKs") + + relations, err := l.manager.ListRelationBySubjectPKGroupPKs(subjectPK, groupPKs) + if err != nil { + return nil, errorWrapf( + err, + "manager.ListRelationBySubjectPKGroupPKs subjectPK=`%d`, parenPKs=`%+v` fail", + subjectPK, groupPKs, + ) + } + + subjectGroups = make([]types.SubjectGroup, 0, len(relations)) + for _, r := range relations { + subjectGroups = append(subjectGroups, types.SubjectGroup{ + PK: r.PK, + GroupPK: r.GroupPK, + ExpiredAt: r.ExpiredAt, + CreatedAt: r.CreatedAt, + }) + } + + return subjectGroups, nil +} + func (l *groupService) ListEffectSubjectGroupsBySubjectPKGroupPKs( subjectPK int64, groupPKs []int64, diff --git a/pkg/service/mock/group.go b/pkg/service/mock/group.go index edbccbbf..7a9f757d 100644 --- a/pkg/service/mock/group.go +++ b/pkg/service/mock/group.go @@ -464,6 +464,21 @@ func (mr *MockGroupServiceMockRecorder) ListPagingTemplateGroupMember(groupPK, t return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPagingTemplateGroupMember", reflect.TypeOf((*MockGroupService)(nil).ListPagingTemplateGroupMember), groupPK, templateID, limit, offset) } +// ListSubjectGroupsBySubjectPKGroupPKs mocks base method. +func (m *MockGroupService) ListSubjectGroupsBySubjectPKGroupPKs(subjectPK int64, groupPKs []int64) ([]types.SubjectGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSubjectGroupsBySubjectPKGroupPKs", subjectPK, groupPKs) + ret0, _ := ret[0].([]types.SubjectGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSubjectGroupsBySubjectPKGroupPKs indicates an expected call of ListSubjectGroupsBySubjectPKGroupPKs. +func (mr *MockGroupServiceMockRecorder) ListSubjectGroupsBySubjectPKGroupPKs(subjectPK, groupPKs interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSubjectGroupsBySubjectPKGroupPKs", reflect.TypeOf((*MockGroupService)(nil).ListSubjectGroupsBySubjectPKGroupPKs), subjectPK, groupPKs) +} + // UpdateGroupMembersExpiredAtWithTx mocks base method. func (m *MockGroupService) UpdateGroupMembersExpiredAtWithTx(tx *sqlx.Tx, groupPK int64, members []types.SubjectTemplateGroup) error { m.ctrl.T.Helper() From 40a37cb51078fbbbe60c193a5c0bc28735c29e5a Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:31:37 +0800 Subject: [PATCH 2/3] Fix model api doc (#304) * fix(apidoc): model api path change to `/api/v1/model` prefix --------- Co-authored-by: kingofzihua --- pkg/api/model/handler/action.go | 6 ++++-- pkg/api/model/handler/instance_selection.go | 6 +++--- pkg/api/model/handler/query.go | 1 + pkg/api/model/handler/resource_type.go | 8 ++++---- pkg/api/model/handler/system.go | 8 ++++---- pkg/api/model/handler/system_config.go | 2 +- pkg/api/model/handler/token.go | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pkg/api/model/handler/action.go b/pkg/api/model/handler/action.go index 7f27548f..ba9808b8 100644 --- a/pkg/api/model/handler/action.go +++ b/pkg/api/model/handler/action.go @@ -36,7 +36,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions [post] +// @Router /api/v1/model/systems/{system_id}/actions [post] func BatchCreateActions(c *gin.Context) { var body []actionSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -123,6 +123,7 @@ func BatchCreateActions(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/actions/{action_id} [put] func UpdateAction(c *gin.Context) { systemID := c.Param("system_id") @@ -255,6 +256,7 @@ func UpdateAction(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/actions/{action_id} [delete] func DeleteAction(c *gin.Context) { systemID := c.Param("system_id") actionID := c.Param("action_id") @@ -278,7 +280,7 @@ func DeleteAction(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions [delete] +// @Router /api/v1/model/systems/{system_id}/actions [delete] func BatchDeleteActions(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/instance_selection.go b/pkg/api/model/handler/instance_selection.go index 443feb4d..3a9e95bf 100644 --- a/pkg/api/model/handler/instance_selection.go +++ b/pkg/api/model/handler/instance_selection.go @@ -38,7 +38,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections [post] +// @Router /api/v1/model/systems/{system_id}/instance-selections [post] func BatchCreateInstanceSelections(c *gin.Context) { var body []instanceSelectionSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -114,7 +114,7 @@ func BatchCreateInstanceSelections(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections/{instance_selection_id} [put] +// @Router /api/v1/model/systems/{system_id}/instance-selections/{instance_selection_id} [put] func UpdateInstanceSelection(c *gin.Context) { systemID := c.Param("system_id") @@ -197,7 +197,7 @@ func UpdateInstanceSelection(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections/{instance_selection_id} [delete] +// @Router /api/v1/model/systems/{system_id}/instance-selections/{instance_selection_id} [delete] func DeleteInstanceSelection(c *gin.Context) { systemID := c.Param("system_id") instanceSelectionID := c.Param("instance_selection_id") diff --git a/pkg/api/model/handler/query.go b/pkg/api/model/handler/query.go index d6be5fd2..7c7b1fa2 100644 --- a/pkg/api/model/handler/query.go +++ b/pkg/api/model/handler/query.go @@ -45,6 +45,7 @@ const ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/query [get] //nolint:gocognit func SystemInfoQuery(c *gin.Context) { var query querySerializer diff --git a/pkg/api/model/handler/resource_type.go b/pkg/api/model/handler/resource_type.go index 22153328..fced03c1 100644 --- a/pkg/api/model/handler/resource_type.go +++ b/pkg/api/model/handler/resource_type.go @@ -38,7 +38,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types [post] +// @Router /api/v1/model/systems/{system_id}/resource-types [post] func BatchCreateResourceTypes(c *gin.Context) { var body []resourceTypeSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -117,7 +117,7 @@ func BatchCreateResourceTypes(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types/{resource_type_id} [put] +// @Router /api/v1/model/systems/{system_id}/resource-types/{resource_type_id} [put] func UpdateResourceType(c *gin.Context) { systemID := c.Param("system_id") @@ -219,7 +219,7 @@ func UpdateResourceType(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types/{resource_type_id} [delete] +// @Router /api/v1/model/systems/{system_id}/resource-types/{resource_type_id} [delete] func DeleteResourceType(c *gin.Context) { systemID := c.Param("system_id") resourceTypeID := c.Param("resource_type_id") @@ -242,7 +242,7 @@ func DeleteResourceType(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types [delete] +// @Router /api/v1/model/systems/{system_id}/resource-types [delete] func BatchDeleteResourceTypes(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/system.go b/pkg/api/model/handler/system.go index 4ef62814..ae832295 100644 --- a/pkg/api/model/handler/system.go +++ b/pkg/api/model/handler/system.go @@ -50,7 +50,7 @@ func defaultValidClients(c *gin.Context, originClients string) string { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems [post] +// @Router /api/v1/model/systems [post] func CreateSystem(c *gin.Context) { // validate the body var body systemSerializer @@ -122,7 +122,7 @@ func CreateSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id} [put] +// @Router /api/v1/model/systems/{system_id} [put] func UpdateSystem(c *gin.Context) { systemID := c.Param("system_id") @@ -210,7 +210,7 @@ func UpdateSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id} [get] +// @Router /api/v1/model/systems/{system_id} [get] func GetSystem(c *gin.Context) { // validate the body systemID := c.Param("system_id") @@ -253,7 +253,7 @@ func GetSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/clients [get] +// @Router /api/v1/model/systems/{system_id}/clients [get] func GetSystemClients(c *gin.Context) { // validate the body systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/system_config.go b/pkg/api/model/handler/system_config.go index a3ef3fb6..8f9d5200 100644 --- a/pkg/api/model/handler/system_config.go +++ b/pkg/api/model/handler/system_config.go @@ -49,7 +49,7 @@ const ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/configs/{name} [POST] +// @Router /api/v1/model/systems/{system_id}/configs/{name} [POST] func CreateOrUpdateConfigDispatch(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/token.go b/pkg/api/model/handler/token.go index afbe5649..d262f87e 100644 --- a/pkg/api/model/handler/token.go +++ b/pkg/api/model/handler/token.go @@ -32,7 +32,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/token [get] +// @Router /api/v1/model/systems/{system_id}/token [get] func GetToken(c *gin.Context) { // validate the body systemID := c.Param("system_id") From 401cb95dd04f4235a10712a34464ddf0bd203fdf Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:10:55 +0800 Subject: [PATCH 3/3] docs: update 1.12.15 version log (#305) --- VERSION | 2 +- release.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d49ade8e..0c86ae8c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.14 +1.12.15 diff --git a/release.md b/release.md index 80788a28..374d15dd 100644 --- a/release.md +++ b/release.md @@ -1,3 +1,18 @@ +# 1.12.15 + +- add: query subject group details api +- bugfix: fix model api doc + +# 1.12.14 + +- build: update dependency +- build: fix lint + +# 1.12.13 + +- update: pkg dependency update +- update: ListExistGroupsHasMemberBeforeExpiredAt api update + # 1.12.12 - add: add default sensitivity level query