Versions in this module Expand all Collapse all v0 v0.10.0 Sep 6, 2026 Changes in this version + const BaseSchema + const PermCreate + const PermDelete + const PermEdit + const PermManage + const PermView + const RelAdmin + const RelEditor + const RelMember + const RelOwner + const RelViewer + const TypeOrganization + const TypePrincipal + const TypeUser + func ResourceSchema(resourceType string) string + type CheckRequest struct + Permission string + ResourceID string + ResourceType string + SubjectID string + SubjectType string + type Client struct + func NewClient(ctx context.Context, cfg Config, logger *slog.Logger) (*Client, error) + func (c *Client) Check(ctx context.Context, req *CheckRequest) (bool, error) + func (c *Client) Close() error + func (c *Client) DeleteRelationship(ctx context.Context, rel *Relationship) error + func (c *Client) IsEmbedded() bool + func (c *Client) LookupResources(ctx context.Context, req *LookupResourcesRequest) ([]string, error) + func (c *Client) LookupSubjects(ctx context.Context, req *LookupSubjectsRequest) ([]string, error) + func (c *Client) ReadSchema(ctx context.Context) (string, error) + func (c *Client) WriteRelationship(ctx context.Context, rel *Relationship) error + func (c *Client) WriteRelationships(ctx context.Context, rels []*Relationship) error + func (c *Client) WriteSchema(ctx context.Context, schema string) error + type Config struct + DatastoreEngine string + DatastoreURI string + Endpoint string + Insecure bool + Mode string + Token string + func DefaultConfig() Config + type LookupResourcesRequest struct + Permission string + ResourceType string + SubjectID string + SubjectType string + type LookupSubjectsRequest struct + Permission string + ResourceID string + ResourceType string + SubjectType string + type Provider struct + func NewProvider(client *Client) *Provider + func (p *Provider) AddOrgMember(ctx context.Context, principalID string, orgID uuid.UUID, role string) error + func (p *Provider) AddRelationship(ctx context.Context, ...) error + func (p *Provider) Can(ctx context.Context, principal authz.Principal, action authz.Action, ...) (bool, error) + func (p *Provider) CanAll(ctx context.Context, principal authz.Principal, actions []authz.Action, ...) (bool, error) + func (p *Provider) CanAny(ctx context.Context, principal authz.Principal, actions []authz.Action, ...) (bool, error) + func (p *Provider) CanForOrg(ctx context.Context, principal authz.Principal, orgID uuid.UUID, ...) (bool, error) + func (p *Provider) Client() *Client + func (p *Provider) Close() error + func (p *Provider) Filter(ctx context.Context, principal authz.Principal, action authz.Action, ...) ([]authz.Resource, error) + func (p *Provider) GetRole(ctx context.Context, principal authz.Principal, orgID uuid.UUID) (string, error) + func (p *Provider) IsMember(ctx context.Context, principal authz.Principal, orgID uuid.UUID) (bool, error) + func (p *Provider) IsPlatformAdmin(ctx context.Context, principal authz.Principal) (bool, error) + func (p *Provider) RemoveOrgMember(ctx context.Context, principalID string, orgID uuid.UUID, role string) error + func (p *Provider) RemoveRelationship(ctx context.Context, ...) error + type Relationship struct + Relation string + ResourceID string + ResourceType string + SubjectID string + SubjectType string + type Syncer struct + func NewSyncer(client *Client) *Syncer + func (s *Syncer) AddOrgMembership(ctx context.Context, principalID, orgID uuid.UUID, role string) error + func (s *Syncer) RegisterOrganization(ctx context.Context, orgID, ownerID uuid.UUID) error + func (s *Syncer) RegisterPrincipal(_ context.Context, _ uuid.UUID) error + func (s *Syncer) RemoveOrgMembership(ctx context.Context, principalID, orgID uuid.UUID, role string) error + func (s *Syncer) SetPlatformAdmin(ctx context.Context, principalID uuid.UUID, isAdmin bool) error + func (s *Syncer) UnregisterOrganization(ctx context.Context, orgID uuid.UUID) error + func (s *Syncer) UnregisterPrincipal(ctx context.Context, principalID uuid.UUID) error + func (s *Syncer) UpdateOrgMembership(ctx context.Context, principalID, orgID uuid.UUID, oldRole, newRole string) error