Documentation
¶
Overview ¶
Package scope defines permission scopes that can be assigned to API keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListFilter ¶
type ListFilter struct {
TenantID string `json:"tenant_id,omitempty"`
Parent string `json:"parent,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
ListFilter contains filters for listing scopes.
type Scope ¶
type Scope struct {
ID id.ScopeID `json:"id" db:"id"`
TenantID string `json:"tenant_id" db:"tenant_id"`
AppID string `json:"app_id" db:"app_id"`
Name string `json:"name" db:"name"`
Description string `json:"description,omitempty" db:"description"`
Parent string `json:"parent,omitempty" db:"parent"`
Metadata map[string]any `json:"metadata,omitempty" db:"metadata"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
Scope defines a permission scope that can be assigned to keys. Scopes are hierarchical: "read:users" is a child of "read".
type Store ¶
type Store interface {
Create(ctx context.Context, s *Scope) error
Get(ctx context.Context, scopeID id.ScopeID) (*Scope, error)
GetByName(ctx context.Context, tenantID, name string) (*Scope, error)
Update(ctx context.Context, s *Scope) error
Delete(ctx context.Context, scopeID id.ScopeID) error
List(ctx context.Context, filter *ListFilter) ([]*Scope, error)
ListByKey(ctx context.Context, keyID id.KeyID) ([]*Scope, error)
AssignToKey(ctx context.Context, keyID id.KeyID, scopeNames []string) error
RemoveFromKey(ctx context.Context, keyID id.KeyID, scopeNames []string) error
}
Store is the persistence interface for permission scopes.
Click to show internal directories.
Click to hide internal directories.