Skip to content

Commit

Permalink
Merge pull request #80 from wklken/fix_delete_action_policies
Browse files Browse the repository at this point in the history
fix(prp/policy_crud): delete action policies return nil if aciton not…
  • Loading branch information
wklken committed Feb 17, 2022
2 parents 6b43732 + 5fb4a2b commit c162701
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/abac/prp/policy_curd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package prp

import (
"database/sql"
"errors"

"github.com/TencentBlueKing/gopkg/collection/set"
Expand Down Expand Up @@ -359,6 +360,11 @@ func (m *policyManager) DeleteByActionID(systemID, actionID string) error {
// 1. 查询 action pk
actionPK, err := m.actionService.GetActionPK(systemID, actionID)
if err != nil {
// if action already deleted, just return
if errors.Is(err, sql.ErrNoRows) {
return nil
}

err = errorWrapf(err, "actionService.GetActionPK systemID=`%s`, actionID=`%s` fail", systemID, actionID)
return err
}
Expand Down

0 comments on commit c162701

Please sign in to comment.