Skip to content

Commit

Permalink
perf: modify command action
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Sep 6, 2024
1 parent cd791ef commit c9d4ccb
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 201 deletions.
11 changes: 6 additions & 5 deletions cmd/impl/convert_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ func ConvertToProtobufPermission(perm model.Actions) *pb.Permission {
}

var ruleActionMap = map[model.CommandAction]pb.CommandACL_Action{
model.ActionUnknown: pb.CommandACL_Unknown,
model.ActionAccept: pb.CommandACL_Accept,
model.ActionReview: pb.CommandACL_Review,
model.ActionReject: pb.CommandACL_Reject,
model.ActionWarning: pb.CommandACL_Warning,
model.ActionUnknown: pb.CommandACL_Unknown,
model.ActionAccept: pb.CommandACL_Accept,
model.ActionReview: pb.CommandACL_Review,
model.ActionReject: pb.CommandACL_Reject,
model.ActionWarning: pb.CommandACL_Warning,
model.ActionNotifyAndWarn: pb.CommandACL_NotifyWarning,
}

func ConvertToProtobufFilterRule(rule model.CommandACL) *pb.CommandACL {
Expand Down
22 changes: 12 additions & 10 deletions pkg/jms-sdk-go/model/filter_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@ type CommandGroup struct {
type CommandAction string

const (
ActionReject = "reject"
ActionAccept = "accept"
ActionReview = "review"
ActionWarning = "warning"
ActionUnknown = "Unknown"
ActionReject = "reject"
ActionAccept = "accept"
ActionReview = "review"
ActionWarning = "warning"
ActionNotifyAndWarn = "notify_and_warn"
ActionUnknown = "Unknown"
)

var (
actionPriorityMap = map[CommandAction]int{
ActionReject: 0,
ActionReview: 1,
ActionWarning: 2,
ActionAccept: 3,
ActionUnknown: 4,
ActionReject: 0,
ActionReview: 1,
ActionNotifyAndWarn: 2,
ActionWarning: 3,
ActionAccept: 4,
ActionUnknown: 5,
}
)
Loading

0 comments on commit c9d4ccb

Please sign in to comment.