authorization

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanCapturedCompletionAuthority

func CanCapturedCompletionAuthority(ctx context.Context, snapshot model.CompletionAuthoritySnapshot) (bool, error)

CanCapturedCompletionAuthority evaluates database-captured permission facts with the same policy as Can. Callers must never supply request-owned facts.

Types

type Input

type Input struct {
	UserSlug          slug.Slug    // The user performing the action
	APIKeySlug        slug.Slug    // Optional API key service principal
	APIKeyRoleSlug    slug.Slug    // Optional API key role in the organization
	OrgSlug           *slug.Slug   // Optional: for organization-scoped authorization
	Action            model.Action // The action being performed
	Resource          fmt.Stringer // The typed resource, including consumer-owned resources
	ResourceOwnerSlug *slug.Slug   // Optional: for ownership checks
}

type Service

type Service interface {
	Can(ctx context.Context, input Input) (bool, error)
}

func New

func New(usersService userssvc.UsersService, rolesService rolessvc.Service) (Service, error)

func NewServiceWithLogging

func NewServiceWithLogging(base Service, logger *slog.Logger) Service

NewServiceWithLogging wraps base with method completion logging.

type ServiceWithLogging

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

ServiceWithLogging implements Service with method completion logging.

func (ServiceWithLogging) Can

func (_d ServiceWithLogging) Can(ctx context.Context, input Input) (b1 bool, err error)

Can implements Service.

Jump to

Keyboard shortcuts

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