Skip to content

Commit

Permalink
fix(rbac) include Negative when marshaling RBAC
Browse files Browse the repository at this point in the history
Include the Negative field when marshaling RBAC types to JSON.

The RBAC entity and endpoint permissions types have custom JSON
marshalers to account for differences between Kong's GET output and the
expected inputs to PUT/PATCH/POST:
https://github.com/Kong/go-kong/pull/5/files#r495600736

Previously, these marshalers omitted the Negative fields, so requests
outbound from go-kong would never set Negative, and it would always be
the default (false).

Fix FTI-2405
  • Loading branch information
Travis Raines committed Mar 30, 2021
1 parent 1b573f2 commit 84a6187
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kong/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ func (e *RBACEndpointPermission) MarshalJSON() ([]byte, error) {
Workspace: e.Workspace,
Endpoint: e.Endpoint,
Actions: String(strings.Join(actions, ",")),
Negative: e.Negative,
Comment: e.Comment,
})
}
Expand Down Expand Up @@ -399,6 +400,7 @@ func (e *RBACEntityPermission) MarshalJSON() ([]byte, error) {
EntityID: e.EntityID,
EntityType: e.EntityType,
Actions: String(strings.Join(actions, ",")),
Negative: e.Negative,
Comment: e.Comment,
})
}
Expand Down

0 comments on commit 84a6187

Please sign in to comment.