Skip to content

Commit

Permalink
Use utility func for returning PermissionDeniedError
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Dec 13, 2022
1 parent d42f8d8 commit 5c6b79a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion acl/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type PermissionDeniedError struct {
Accessor string
// Resource (e.g. Service)
Resource Resource
// Access leve (e.g. Read)
// Access level (e.g. Read)
AccessLevel AccessLevel
// e.g. "sidecar-proxy-1"
ResourceID ResourceDescriptor
Expand Down
4 changes: 2 additions & 2 deletions agent/structs/config_entry_gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ func (e *BoundAPIGatewayConfigEntry) CanRead(authz acl.Authorizer) error {
return authz.ToAllowAuthorizer().ServiceReadAllowed(e.Name, &authzContext)
}

func (e *BoundAPIGatewayConfigEntry) CanWrite(authz acl.Authorizer) error {
return acl.PermissionDeniedError{Cause: "only writeable by controller"}
func (e *BoundAPIGatewayConfigEntry) CanWrite(_ acl.Authorizer) error {
return acl.PermissionDenied("only writeable by controller")
}

func (e *BoundAPIGatewayConfigEntry) GetRaftIndex() *RaftIndex {
Expand Down

0 comments on commit 5c6b79a

Please sign in to comment.