Documentation
¶
Index ¶
Constants ¶
View Source
const ( // PolicyDenyAll defines a string to use to deny all access. PolicyDenyAll = "DENY_ALL" // PolicyDefaultDeny defines a string to use to deny access by default, with exceptions. PolicyDefaultDeny = "DEFAULT_DENY" // PolicyAllowAll defines a string to use to allow all access. PolicyAllowAll = "ALLOW_ALL" // PolicyDefaultAllow defines a string to use to allow access by default, with exceptions. PolicyDefaultAllow = "DEFAULT_ALLOW" )
Variables ¶
View Source
var ( // ErrScopeAlreadyExists is returned when attempting to create a Scope that already exists. ErrScopeAlreadyExists = errors.New("scope already exists") )
Functions ¶
func ByID ¶
func ByID(scopes []Scope)
ByID sorts the passed Scopes in place lexicographically by their IDs.
func ClientCanUseScope ¶
ClientCanUseScope returns true if the client specified by `client` can use `scope`.
func IsValidPolicy ¶
IsValidPolicy returns whether a string is a valid policy or not.
Types ¶
type Change ¶
type Change struct {
UserPolicy *string
UserExceptions *[]string
ClientPolicy *string
ClientExceptions *[]string
IsDefault *bool
}
Change represents a change to a Scope.
type Dependencies ¶
type Dependencies struct {
Storer Storer
}
Dependencies holds the common dependencies that will be used throughout the package.
type Scope ¶
type Scope struct {
ID string
UserPolicy string
UserExceptions []string
ClientPolicy string
ClientExceptions []string
IsDefault bool
}
Scope defines a scope of access to user data that users can grant.
type Storer ¶
type Storer interface {
Create(ctx context.Context, scope Scope) error
GetMulti(ctx context.Context, ids []string) (map[string]Scope, error)
ListDefault(ctx context.Context) ([]Scope, error)
Update(ctx context.Context, id string, change Change) error
Delete(ctx context.Context, id string) error
}
Storer is an interface for storing and retrieving Scopes and the metadata surrounding them.
Click to show internal directories.
Click to hide internal directories.