Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidIdentifier(in string) bool
- func NormalizeIdentifier(in string) (string, error)
- type ArrowPermission
- type ExclusionPermission
- type Identifier
- type Metadata
- type Model
- type Object
- type ObjectName
- type Permission
- type PermissionName
- type Relation
- type RelationName
- type SubjectRelation
Constants ¶
View Source
const ModelVersion int = 1
Variables ¶
View Source
var ErrInvalidIdentifier = errors.New("invalid identifier")
Functions ¶
func IsValidIdentifier ¶ added in v0.0.5
func NormalizeIdentifier ¶ added in v0.0.5
Types ¶
type ArrowPermission ¶
type ExclusionPermission ¶
type Identifier ¶ added in v0.0.5
type Identifier string
Identifier is the string representation of an object, relation and permission type name.
Identifiers are bounded by the underlying defined regex definition (reIdentifier).
An identifier MUST be: - all lowercase characters - have a minimum length of 3 characters - have a maximum length of 64 characters - start with a character (a-z) - end with a character of a digit (a-z0-9) - can contain dots, underscores and dashes, between the first and last position.
func (Identifier) Valid ¶ added in v0.0.5
func (i Identifier) Valid() bool
type Model ¶
type Model struct { Version int `json:"version"` Objects map[ObjectName]*Object `json:"types"` Metadata *Metadata `json:"metadata"` }
type Object ¶
type Object struct { Relations map[RelationName][]*Relation `json:"relations,omitempty"` Permissions map[PermissionName]*Permission `json:"permissions,omitempty"` }
type ObjectName ¶
type ObjectName Identifier
type Permission ¶
type Permission struct { Union []string `json:"union,omitempty"` Intersection []string `json:"intersection,omitempty"` Exclusion *ExclusionPermission `json:"exclusion,omitempty"` Arrow *ArrowPermission `json:"arrow,omitempty"` }
type PermissionName ¶
type PermissionName Identifier
type Relation ¶
type Relation struct { Direct ObjectName `json:"direct,omitempty"` Subject *SubjectRelation `json:"subject,omitempty"` Wildcard ObjectName `json:"wildcard,omitempty"` }
type RelationName ¶
type RelationName Identifier
type SubjectRelation ¶
type SubjectRelation struct { Object ObjectName `json:"object,omitempty"` Relation RelationName `json:"relation,omitempty"` }
Click to show internal directories.
Click to hide internal directories.