authorization

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package authorization resolves product permissions from stable Role identities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanReceiveAgentShare

func CanReceiveAgentShare(workspaceID string, workspaceGrants []gatewaydb.PermissionAction, administrator bool, grants []gatewaydb.AgentShareCapability) (bool, error)

CanReceiveAgentShare reports whether the supplied Workspace grants support every effective capability in the proposed Agent Share.

Types

type Agent

type Agent struct {
	Name        string
	OwnerUserID string
	ShareGrants []gatewaydb.AgentShareCapability
}

Agent describes the relationship facts used to authorize one Agent.

type AgentCapabilities

type AgentCapabilities struct {
	Use             bool
	Modify          bool
	Delete          bool
	Share           bool
	ManageOwnership bool
	ReadSecrets     bool
	WriteSecrets    bool
	DeleteSecrets   bool
}

AgentCapabilities is the complete action projection for one Agent.

func (AgentCapabilities) CoversShare

func (c AgentCapabilities) CoversShare(grants []gatewaydb.AgentShareCapability) bool

CoversShare reports whether these effective capabilities contain every action represented by the proposed Agent Share grants.

type Effective

type Effective struct {
	// contains filtered or unexported fields
}

Effective is an immutable snapshot of one Subject's effective permissions.

func (Effective) Active

func (e Effective) Active() bool

Active reports whether the subject has an enabled Membership in the Organisation. A grant-free active Membership remains active.

func (Effective) AgentCapabilities

func (e Effective) AgentCapabilities(scope Scope, agent Agent) (AgentCapabilities, error)

AgentCapabilities evaluates Workspace grants, ownership, and Agent Shares through the Cedar policy set.

func (Effective) Allows

func (e Effective) Allows(scope Scope, operation Operation) bool

Allows reports whether an explicitly mapped operation is allowed in the exact scope.

func (Effective) CanAdminister

func (e Effective) CanAdminister(scope Scope) bool

CanAdminister reports whether a built-in role bypass applies to the exact scope.

func (Effective) CanReceiveAgentShare

func (e Effective) CanReceiveAgentShare(scope Scope, grants []gatewaydb.AgentShareCapability) (bool, error)

CanReceiveAgentShare reports whether the subject's Workspace grants support every effective capability in the proposed Agent Share.

func (Effective) HasAccess

func (e Effective) HasAccess(scope Scope) bool

HasAccess reports whether the subject has any active authority in the exact scope. Agent ownership depends on this so ownership alone cannot retain access after all independent authority is revoked.

type Operation

type Operation string

Operation identifies a generated gateway operation.

const (
	// OperationListSkills lists immutable Skill resources.
	OperationListSkills Operation = "listSkills"
	// OperationCreateSkill creates an immutable Skill resource.
	OperationCreateSkill Operation = "createSkill"
	// OperationUpdateSkill modifies an immutable Skill resource.
	OperationUpdateSkill Operation = "updateSkill"
	// OperationDeleteSkill deletes an immutable Skill resource.
	OperationDeleteSkill Operation = "deleteSkill"
	// OperationListSandboxes lists Sandbox resources.
	OperationListSandboxes Operation = "listSandboxes"
	// OperationCreateSandbox creates a Sandbox resource.
	OperationCreateSandbox Operation = "createSandbox"
	// OperationUpdateSandbox modifies a Sandbox resource.
	OperationUpdateSandbox Operation = "updateSandbox"
	// OperationDeleteSandbox deletes a Sandbox resource.
	OperationDeleteSandbox Operation = "deleteSandbox"
	// OperationListMCPConnections lists MCP Connection resources.
	OperationListMCPConnections Operation = "listMCPConnections"
	// OperationWatchMCPConnections watches MCP Connection resources.
	OperationWatchMCPConnections Operation = "watchMCPConnections"
	// OperationGetMCPConnection reads one MCP Connection resource.
	OperationGetMCPConnection Operation = "getMCPConnection"
	// OperationCreateMCPConnection creates an MCP Connection resource.
	OperationCreateMCPConnection Operation = "createMCPConnection"
	// OperationDeleteMCPConnection deletes an MCP Connection resource.
	OperationDeleteMCPConnection Operation = "deleteMCPConnection"
	// OperationListInferenceProviders lists Inference Provider resources.
	OperationListInferenceProviders Operation = "listInferenceProviders"
	// OperationWatchInferenceProviders watches Inference Provider resources.
	OperationWatchInferenceProviders Operation = "watchInferenceProviders"
	// OperationGetInferenceProvider reads one Inference Provider resource.
	OperationGetInferenceProvider Operation = "getInferenceProvider"
	// OperationGetInferenceProviderUsage reads Inference Provider usage.
	OperationGetInferenceProviderUsage Operation = "getInferenceProviderUsage"
	// OperationRefreshInferenceProviderModels reads current Provider models.
	OperationRefreshInferenceProviderModels Operation = "refreshInferenceProviderModels"
	// OperationListInferenceProviderCatalog reads the Provider catalog.
	OperationListInferenceProviderCatalog Operation = "listInferenceProviderCatalog"
	// OperationListInferenceModelSuggestions reads catalog model suggestions.
	OperationListInferenceModelSuggestions Operation = "listInferenceModelSuggestions"
	// OperationCreateInferenceProvider creates an Inference Provider resource.
	OperationCreateInferenceProvider Operation = "createInferenceProvider"
	// OperationCreateInferenceProviderOAuthTicket creates Provider credentials.
	OperationCreateInferenceProviderOAuthTicket Operation = "createInferenceProviderOAuthTicket"
	// OperationUpdateInferenceProvider modifies an Inference Provider resource.
	OperationUpdateInferenceProvider Operation = "updateInferenceProvider"
	// OperationDeleteInferenceProvider deletes an Inference Provider resource.
	OperationDeleteInferenceProvider Operation = "deleteInferenceProvider"
	// OperationListInferencePools lists Inference Pool resources.
	OperationListInferencePools Operation = "listInferencePools"
	// OperationWatchInferencePools watches Inference Pool resources.
	OperationWatchInferencePools Operation = "watchInferencePools"
	// OperationGetInferencePool reads one Inference Pool resource.
	OperationGetInferencePool Operation = "getInferencePool"
	// OperationGetInferencePoolUsage reads Inference Pool usage.
	OperationGetInferencePoolUsage Operation = "getInferencePoolUsage"
	// OperationCreateInferencePool creates an Inference Pool resource.
	OperationCreateInferencePool Operation = "createInferencePool"
	// OperationUpdateInferencePool modifies an Inference Pool resource.
	OperationUpdateInferencePool Operation = "updateInferencePool"
	// OperationDeleteInferencePool deletes an Inference Pool resource.
	OperationDeleteInferencePool Operation = "deleteInferencePool"
	// OperationListAgents lists Agent resources.
	OperationListAgents Operation = "listAgents"
	// OperationWatchAgents watches Agent resources.
	OperationWatchAgents Operation = "watchAgents"
	// OperationCreateAgent creates an Agent resource.
	OperationCreateAgent Operation = "createAgent"
	// OperationUpdateAgent modifies an Agent resource.
	OperationUpdateAgent Operation = "updateAgent"
	// OperationDeleteAgent deletes an Agent resource.
	OperationDeleteAgent Operation = "deleteAgent"
	// OperationShareAuthoredAgent shares an Agent owned by the caller.
	OperationShareAuthoredAgent Operation = "shareAuthoredAgent"
	// OperationShareNonAuthoredAgent shares an Agent through delegation.
	OperationShareNonAuthoredAgent Operation = "shareNonAuthoredAgent"
	// OperationUseSharedAgent uses a shared Agent.
	OperationUseSharedAgent Operation = "useSharedAgent"
	// OperationReadSharedSecret reads shared Agent secret metadata.
	OperationReadSharedSecret Operation = "readSharedSecret"
	// OperationWriteSharedSecret writes a shared Agent secret.
	OperationWriteSharedSecret Operation = "writeSharedSecret"
	// OperationDeleteSharedSecret deletes a shared Agent secret.
	OperationDeleteSharedSecret Operation = "deleteSharedSecret"
	// OperationListAPIKeys lists Workspace API key metadata.
	OperationListAPIKeys Operation = "listAPIKeys"
	// OperationCreateAPIKey creates a Workspace API key.
	OperationCreateAPIKey Operation = "createAPIKey"
	// OperationDeleteAPIKey deletes a Workspace API key.
	OperationDeleteAPIKey Operation = "deleteAPIKey"
	// OperationReadObservability reads Workspace observability.
	OperationReadObservability Operation = "readObservability"
)

func (Operation) BearerScope

func (o Operation) BearerScope() (string, bool)

BearerScope returns the generated bearer scope for the operation.

type Queries

type Queries interface {
	GatewayResolvePermissions(ctx context.Context, arg gatewaydb.GatewayResolvePermissionsParams) ([]gatewaydb.GatewayResolvePermissionsRow, error)
}

Queries is the generated persistence used to resolve assigned Role grants.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver resolves direct and Team Role grants for one active Organisation Membership.

func New

func New(queries Queries) *Resolver

New returns a Resolver backed by generated sqlc queries.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, subject Subject) (Effective, error)

Resolve returns a fresh union of direct and Team Roles assigned to an active member. Missing and disabled Memberships resolve to no permissions.

type Scope

type Scope struct {
	OrganizationID string
	WorkspaceID    string
}

Scope identifies an Organisation or one of its Workspaces.

type Subject

type Subject struct {
	UserID         string
	OrganizationID string
}

Subject identifies a User within one Organisation.

Jump to

Keyboard shortcuts

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