v1

package
v0.0.0-...-0490640 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Version int = 1

Version is the internal policy version

Variables

This section is empty.

Functions

func DefaultPolicies

func DefaultPolicies() (map[string]*Policy, error)

DefaultPolicies returns all the default policies initially created. It is strictly used for testing and memstore.

TODO (tc) This is used for testing and memstore as postgres handles non-deletable policies directly. I think we should consider getting rid of memstore.

func IsNonDeletablePolicy

func IsNonDeletablePolicy(id string) bool

IsNonDeletablePolicy returns true for UUID strings associated with policies marked as non-deletable and false otherwise.

TODO (tc) This is used for testing and memstore as postgres handles non-deletable policies directly. I think we should consider getting rid of memstore.

Types

type PoliciesLister

type PoliciesLister interface {
	ListPoliciesWithSubjects(ctx context.Context) ([]*Policy, error)
}

PoliciesLister is the interface that wraps the ListPoliciesWithSubjects method used for migrating to v2.

type Policy

type Policy struct {
	Action    string
	ID        uuid.UUID
	Resource  string
	Subjects  []string
	Effect    string
	CreatedAt time.Time
	UpdatedAt time.Time
	Version   int
}

Policy represents the policy that will be stored.

type Resetter

type Resetter interface {
	Reset(context.Context) error
}

Resetter is, if exposed, used for tests to reset the storage backend to a pristine state.

type Storage

type Storage interface {
	StorePolicy(ctx context.Context, action string, subjects []string, resource string, effect string) (*Policy, error)
	DeletePolicy(ctx context.Context, id string) (*Policy, error)
	PurgeSubjectFromPolicies(ctx context.Context, subject string) ([]uuid.UUID, error)
	ListPolicies(ctx context.Context) ([]*Policy, error)

	PoliciesLister
}

Storage is the interface provided by our various storage backends.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL