share

package
v0.68.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 18 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddShareCreateHandler

func AddShareCreateHandler(logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler ShareCreateHandler)

func BuildSharePolicy

func BuildSharePolicy(uuid string, entity Shareable, ownerId uint, actions []string) ladon.Policy

func KernelMiddlewareShares

func KernelMiddlewareShares(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Middleware, error)

func NewShareCreateHandler

func NewShareCreateHandler(logger log.Logger, transformer ShareCreateHandler) gin.HandlerFunc

func NewShareManager

func NewShareManager(ctx context.Context, config cfg.Config, logger log.Logger) (*shareManager, error)

func NewShareableRepository

func NewShareableRepository(ctx context.Context, config cfg.Config, logger log.Logger, repo db_repo.Repository) (*shareRepository, error)

func ProvideRepository

func ProvideRepository(ctx context.Context, config cfg.Config, logger log.Logger) (db_repo.Repository, error)

func ProvideShareManager

func ProvideShareManager(ctx context.Context, config cfg.Config, logger log.Logger) (*shareManager, error)

Types

type BaseShareHandler

type BaseShareHandler interface {
	GetEntityModel() Shareable
	GetEntityRepository() db_repo.Repository
	GetGuard() guard.Guard
	GetModel() ModelBased
	GetRepository() db_repo.Repository
	TransformOutput(ctx context.Context, model db_repo.ModelBased, apiView string) (output any, err error)
}

type EntityDeleteHandler

type EntityDeleteHandler interface {
	BaseShareHandler
}

type EntityUpdateHandler

type EntityUpdateHandler interface {
	BaseShareHandler
	crud.BaseUpdateHandler
}

type Metadata

type Metadata interface {
	GetOwnerId() uint
	GetActions() []string
}

type ModelBased

type ModelBased interface {
	db_repo.ModelBased
	GetPolicyId() string
}

type Settings

type Settings struct {
	TableName struct {
		Owner  string `cfg:"owner" default:"owners"`
		Policy string `cfg:"policy" default:"policies"`
		Share  string `cfg:"share" default:"shares"`
	} `cfg:"table_name"`
}

type Share

type Share struct {
	db_repo.Model
	EntityId   uint
	EntityType string
	OwnerId    uint
	PolicyId   string
}

func (*Share) GetPolicyId

func (s *Share) GetPolicyId() string

type ShareCreateHandler

type ShareCreateHandler interface {
	BaseShareHandler
	GetCreateInput() Metadata
	TransformCreate(ctx context.Context, input any, entity Shareable, policy ladon.Policy, model db_repo.ModelBased) (err error)
}

type Shareable

type Shareable interface {
	db_repo.ModelBased
	GetResources() []string
	GetEntityType() string
}

type WithPolicy

type WithPolicy interface {
	GetPolicyId() string
}

Jump to

Keyboard shortcuts

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