open-consul/acl/errors_oss.go
Mark Anderson fa95afdcf6 Refactor to make ACL errors more structured. (#12308)
* First phase of refactoring PermissionDeniedError

Add extended type PermissionDeniedByACLError that captures information
about the accessor, particular permission type and the object and name
of the thing being checked.

It may be worth folding the test and error return into a single helper
function, that can happen at a later date.

Signed-off-by: Mark Anderson <manderson@hashicorp.com>
2022-02-11 12:53:23 -08:00

19 lines
446 B
Go

//go:build !consulent
// +build !consulent
package acl
// In some sense we really want this to contain an EnterpriseMeta, but
// this turns out to be a convenient place to hang helper functions off of.
type ResourceDescriptor struct {
Name string
}
func NewResourceDescriptor(name string, _ *AuthorizerContext) ResourceDescriptor {
return ResourceDescriptor{Name: name}
}
func (od *ResourceDescriptor) ToString() string {
return od.Name
}