share

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 18 Imported by: 0

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(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 interface{}, 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 interface{}, 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