Skip to content

Commit

Permalink
for any service set defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Dec 11, 2024
1 parent effb7eb commit f14d916
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func createAcl(w http.ResponseWriter, r *http.Request) {
acl.CreatedBy = user.UserName
acl.CreatedAt = time.Now().UTC()
acl.Default = false
if acl.ServiceType == models.Any {
acl.Port = []string{}
acl.Proto = models.ALL
}
// validate create acl policy
if !logic.IsAclPolicyValid(acl) {
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("invalid policy"), "badrequest"))
Expand Down
4 changes: 4 additions & 0 deletions logic/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ func UpdateAcl(newAcl, acl models.Acl) error {
acl.Proto = newAcl.Proto
acl.ServiceType = newAcl.ServiceType
}
if newAcl.ServiceType == models.Any {
acl.Port = []string{}
acl.Proto = models.ALL
}
acl.Enabled = newAcl.Enabled
d, err := json.Marshal(acl)
if err != nil {
Expand Down

0 comments on commit f14d916

Please sign in to comment.