Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: allow to delete AccessControl policy (#3821)

rebelice36b0badb5843
diff --git a/store/policy.go b/store/policy.go
index 0f591a7790..5c62f83e89 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -93,9 +93,12 @@ func (s *Store) GetPolicy(ctx context.Context, find *api.PolicyFind) (*api.Polic
// DeletePolicy deletes an existing ARCHIVED policy by PolicyDelete.
func (s *Store) DeletePolicy(ctx context.Context, policyDelete *api.PolicyDelete) error {
// Validate policy.
- // Currently we only support PolicyTypeSQLReview type policy to delete by id
- if policyDelete.Type != api.PolicyTypeSQLReview {
- return &common.Error{Code: common.Invalid, Err: errors.Errorf("invalid policy type")}
+ // Currently we only support PolicyTypeSQLReview and PolicyTypeAccessControl type policy to delete by id
+ switch policyDelete.Type {
+ case api.PolicyTypeSQLReview:
+ case api.PolicyTypeAccessControl:
+ default:
+ return &common.Error{Code: common.Invalid, Err: errors.Errorf("invalid deleted policy type")}
}
tx, err := s.db.BeginTx(ctx, nil)