Documentation
¶
Index ¶
Constants ¶
View Source
const ( Users identityType = "users" Codebases identityType = "codebases" Groups identityType = "groups" ACLs identityType = "acls" Files identityType = "files" )
Variables ¶
View Source
var ( ErrTestFails = fmt.Errorf("test fails") ErrSubgroupsForbidden = fmt.Errorf("groups can't have other groups as memebers") ErrUnsupportedIdentityType = fmt.Errorf("unsupported identity type") ErrTestMustHaveCondition = fmt.Errorf("test must have either 'allow' or 'deny' condition") ErrUnsupportedActionType = fmt.Errorf("unsupported action type") ErrACLTestMissing = func(id string) error { return fmt.Errorf("at least one 'allow write' test must exist for 'acls::%s' resource", id) } )
Functions ¶
This section is empty.
Types ¶
type ACL ¶
type ACL struct {
ID ID `json:"id" db:"id"`
CodebaseID string `json:"codebase_id" db:"codebase_id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
RawPolicy string `json:"policy" db:"policy"`
// Policy contains a policy parsed from RawPolicy
// Note that changes from this field won't be persisted in the database
Policy Policy `json:"-" db:"-"`
}
type Group ¶
type Group struct {
ID string `json:"id,omitempty"`
Members []*Identifier `json:"members,omitempty"`
}
type Identifier ¶
type Identifier struct {
Type identityType `json:"type,omitempty"`
Pattern string `json:"pattern,omitempty"`
}
func (*Identifier) MarshalJSON ¶
func (i *Identifier) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaller to override resulting format.
func (*Identifier) Matches ¶
func (i *Identifier) Matches(identity Identity) bool
func (*Identifier) UnmarshalJSON ¶
func (i *Identifier) UnmarshalJSON(v []byte) error
UnmarshalJSON implements encoding/json.UnmarshalJSON to parse source JSON in a different way.
type Identity ¶
type Identity struct {
ID string `json:"id,omitempty"`
Type identityType `json:"type,omitempty"`
}
func (*Identity) MarshalJSON ¶
MarshalJSON implements encoding/json.Marshaller to override resulting format.
func (*Identity) ParseString ¶
func (*Identity) UnmarshalJSON ¶
UnmarshalJSON implements encoding/json.UnmarshalJSON to parse source JSON in a different way.
type Policy ¶
type Policy struct {
Rules []*Rule `json:"rules,omitempty"`
Groups []*Group `json:"groups,omitempty"`
Tests []*Test `json:"tests,omitempty"`
}
type Rule ¶
type Rule struct {
ID string `json:"id,omitempty"`
Action Action `json:"action,omitempty"`
Principals []*Identifier `json:"principals,omitempty"`
Resources []*Identifier `json:"resources,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.