Skip to content

Commit

Permalink
fix: BulkUpdateSubjectSystemGroupBySubjectTemplateGroupWithTx
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu327 committed Dec 6, 2023
1 parent 3c96e31 commit d45a516
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
22 changes: 22 additions & 0 deletions build/support-files/templates/#etc#bkiam_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ customQuotas:
max_actions_limit: 1500
max_resource_types_limit: 500
max_instance_selections_limit: 500
- id: bk_paas3
quota:
web:
subject_max_groups_limit: 1000
- id: bk_bcs_app
quota:
web:
subject_max_groups_limit: 500
- id: bk_ci_rbac
quota:
web:
subject_max_groups_limit: 30000
model:
max_actions_limit: 200
- id: bk_monitorv3
quota:
web:
subject_max_groups_limit: 1000
- id: bk_log_search
quota:
web:
subject_max_groups_limit: 1000

logger:
system:
Expand Down
48 changes: 25 additions & 23 deletions pkg/service/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,18 +646,22 @@ func (l *groupService) BulkUpdateSubjectSystemGroupBySubjectTemplateGroupWithTx(
}

for _, systemID := range systemIDs {
for _, r := range relations {
err := l.addOrUpdateSubjectSystemGroup(tx, r.SubjectPK, systemID, relation.GroupPK, r.ExpiredAt)
if err != nil {
return errorWrapf(
err,
"addOrUpdateSubjectSystemGroup systemID=`%s`, subjectPK=`%d`, groupPK=`%d`, expiredAt=`%d`, fail",
systemID,
r.SubjectPK,
relation.GroupPK,
r.ExpiredAt,
)
}
err := l.addOrUpdateSubjectSystemGroup(
tx,
relation.SubjectPK,
systemID,
relation.GroupPK,
relation.ExpiredAt,
)
if err != nil {
return errorWrapf(
err,
"addOrUpdateSubjectSystemGroup systemID=`%s`, subjectPK=`%d`, groupPK=`%d`, expiredAt=`%d`, fail",
systemID,
relation.SubjectPK,
relation.GroupPK,
relation.ExpiredAt,
)
}
}
}
Expand Down Expand Up @@ -751,17 +755,15 @@ func (l *groupService) BulkDeleteSubjectTemplateGroupWithTx(
}

for _, systemID := range systemIDs {
for _, r := range relations {
err = l.removeSubjectSystemGroup(tx, r.SubjectPK, systemID, relation.GroupPK)
if err != nil {
return errorWrapf(
err,
"removeSubjectSystemGroup systemID=`%s`, subjectPK=`%d`, groupPK=`%d`, fail",
systemID,
r.SubjectPK,
relation.GroupPK,
)
}
err = l.removeSubjectSystemGroup(tx, relation.SubjectPK, systemID, relation.GroupPK)
if err != nil {
return errorWrapf(
err,
"removeSubjectSystemGroup systemID=`%s`, subjectPK=`%d`, groupPK=`%d`, fail",
systemID,
relation.SubjectPK,
relation.GroupPK,
)
}
}
}
Expand Down

0 comments on commit d45a516

Please sign in to comment.