Back to godoc.org
github.com/hashicorp/vault/sdk / helper / policyutil

package policyutil

v0.1.13
Latest Go to latest
Published: Jul 25, 2019 | License: MPL-2.0 | Module: github.com/hashicorp/vault/sdk

Index

Constants

const (
	AddDefaultPolicy      = true
	DoNotAddDefaultPolicy = false
)

func EquivalentPolicies

func EquivalentPolicies(a, b []string) bool

EquivalentPolicies checks whether the given policy sets are equivalent, as in, they contain the same values. The benefit of this method is that it leaves the "default" policy out of its comparisons as it may be added later by core after a set of policies has been saved by a backend.

func ParsePolicies

func ParsePolicies(policiesRaw interface{}) []string

ParsePolicies parses a comma-delimited list of policies. The resulting collection will have no duplicate elements. If 'root' policy was present in the list of policies, then all other policies will be ignored, the result will contain just the 'root'. In cases where 'root' is not present, if 'default' policy is not already present, it will be added.

func SanitizePolicies

func SanitizePolicies(policies []string, addDefault bool) []string

SanitizePolicies performs the common input validation tasks which are performed on the list of policies across Vault. The resulting collection will have no duplicate elements. If 'root' policy was present in the list of policies, then all other policies will be ignored, the result will contain just the 'root'. In cases where 'root' is not present, if 'default' policy is not already present, it will be added if addDefault is set to true.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier