policy

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package policy provides Rego policy generation for FTL authorization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// For private mode: the owner's subject
	OwnerSubject string

	// For org mode: list of org member subjects
	OrgMembers []string

	// For org mode: the organization ID
	OrgID string

	// Actor type for deployment context
	ActorType string // "user" or "machine"
}

Context provides information needed for policy generation

type Generator

type Generator struct{}

Generator creates Rego policies for different authorization modes

func New

func New() *Generator

New creates a new policy generator

func (*Generator) Generate

func (g *Generator) Generate(mode Mode, ctx *Context) (*Policy, error)

Generate creates a policy and data for the given mode and context

type Mode

type Mode string

Mode represents the authorization mode

const (
	ModePublic  Mode = "public"
	ModePrivate Mode = "private"
	ModeOrg     Mode = "org"
	ModeCustom  Mode = "custom"
)

type Policy

type Policy struct {
	// The Rego policy source code
	Source string

	// The policy data (will be JSON encoded)
	Data map[string]interface{}
}

Policy represents a Rego policy with its data

func (*Policy) ToJSON

func (p *Policy) ToJSON() (string, error)

ToJSON converts policy data to JSON string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL