Documentation
¶
Index ¶
- Variables
- func NewAnonymousByteIdentity() *byteIdentity
- func NewAnonymousIdentity() *identity
- func NewByteIdentity(id []byte) *byteIdentity
- func NewByteIdentityProvides(id []byte, capabilities ...*Capability) *byteIdentity
- func NewByteIdentitySet(id []byte, set *Set) *byteIdentity
- func NewIdentity(id int64) *identity
- func NewIdentityProvides(id int64, capabilities ...*Capability) *identity
- func NewIdentitySet(id int64, set *Set) *identity
- type Capability
- type Identity
- type Permission
- func (p *Permission) Allows(id Identity) bool
- func (p *Permission) DecodeFrom(js string) error
- func (p *Permission) Difference(other *Permission) *Permission
- func (p *Permission) Encode() string
- func (p *Permission) IsSubset(other *Permission) bool
- func (p *Permission) Reverse() *Permission
- func (p *Permission) String() string
- func (p *Permission) Union(other *Permission) *Permission
- type Set
- func (s *Set) Add(capability *Capability) bool
- func (s *Set) AddItems(capabilities ...*Capability)
- func (s *Set) Cardinality() int
- func (s *Set) Contains(capability *Capability) bool
- func (s *Set) Difference(other *Set) *Set
- func (s *Set) Equals(other *Set) bool
- func (s *Set) Intersection(other *Set) *Set
- func (s *Set) IsSubset(other *Set) bool
- func (s *Set) IsSuperset(other *Set) bool
- func (s *Set) Iterator(it chan *Capability)
- func (s *Set) Slice() []*Capability
- func (s *Set) String() string
- func (s *Set) Union(other *Set) *Set
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrPermissionDenied = errors.New("permission denied")
)
Functions ¶
func NewAnonymousByteIdentity ¶
func NewAnonymousByteIdentity() *byteIdentity
func NewAnonymousIdentity ¶
func NewAnonymousIdentity() *identity
func NewByteIdentity ¶
func NewByteIdentity(id []byte) *byteIdentity
func NewByteIdentityProvides ¶
func NewByteIdentityProvides(id []byte, capabilities ...*Capability) *byteIdentity
func NewByteIdentitySet ¶
func NewIdentity ¶
func NewIdentity(id int64) *identity
func NewIdentityProvides ¶
func NewIdentityProvides(id int64, capabilities ...*Capability) *identity
func NewIdentitySet ¶
Types ¶
type Capability ¶
type Capability struct { Method string `json:"method"` Value interface{} `json:"value"` Subject string `json:"subject"` }
func NewCapability ¶
func NewCapability(method string, value interface{}) *Capability
func NewCapabilitySubject ¶
func NewCapabilitySubject(method string, value interface{}, subject string) *Capability
func (*Capability) Hash ¶
func (o *Capability) Hash() string
func (*Capability) Is ¶
func (o *Capability) Is(capability *Capability) bool
func (*Capability) String ¶
func (o *Capability) String() string
type Identity ¶
type Identity interface { Can(*Permission) bool Provides() *Set }
type Permission ¶
func NewEmptyPermission ¶
func NewEmptyPermission() *Permission
func NewPermission ¶
func NewPermission(capabilities ...*Capability) *Permission
func NewPermissionSet ¶
func NewPermissionSet(requires *Set) *Permission
func NewPermissionSetFull ¶
func NewPermissionSetFull(requires, excludes *Set) *Permission
func (*Permission) Allows ¶
func (p *Permission) Allows(id Identity) bool
func (*Permission) DecodeFrom ¶
func (p *Permission) DecodeFrom(js string) error
func (*Permission) Difference ¶
func (p *Permission) Difference(other *Permission) *Permission
func (*Permission) Encode ¶
func (p *Permission) Encode() string
func (*Permission) IsSubset ¶
func (p *Permission) IsSubset(other *Permission) bool
func (*Permission) Reverse ¶
func (p *Permission) Reverse() *Permission
func (*Permission) String ¶
func (p *Permission) String() string
func (*Permission) Union ¶
func (p *Permission) Union(other *Permission) *Permission
type Set ¶
func NewSet ¶
func NewSet(capabilities ...*Capability) *Set
func (*Set) Add ¶
func (s *Set) Add(capability *Capability) bool
func (*Set) AddItems ¶
func (s *Set) AddItems(capabilities ...*Capability)
func (*Set) Cardinality ¶
func (*Set) Contains ¶
func (s *Set) Contains(capability *Capability) bool
func (*Set) Difference ¶
func (*Set) Intersection ¶
func (*Set) IsSuperset ¶
func (*Set) Iterator ¶
func (s *Set) Iterator(it chan *Capability)
func (*Set) Slice ¶
func (s *Set) Slice() []*Capability
Click to show internal directories.
Click to hide internal directories.