publicshare

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StorageIDFilterType defines a new filter type for storage id.
	// TODO: Remove this once the filter type is in the CS3 API.
	StorageIDFilterType link.ListPublicSharesRequest_Filter_Type = 4
)

Variables

View Source
var (
	// ErrShareNeedsPassword is an error which is returned when a public share must have a password.
	ErrShareNeedsPassword = errors.New("the public share needs to have a password")
)

Functions

func AddSignature

func AddSignature(share *link.PublicShare, pw string) error

AddSignature augments a public share with a signature. The signature has a validity of 30 minutes.

func Authenticate added in v2.1.0

func Authenticate(share *link.PublicShare, pw string, auth *link.PublicShareAuthentication) bool

Authenticate checks the signature or password authentication for a public share

func CreateSignature

func CreateSignature(token, pw string, expiration time.Time) (string, error)

CreateSignature calculates a signature for a public share.

func GroupFiltersByType

GroupFiltersByType groups the given filters and returns a map using the filter type as the key.

func IsCreatedByUser added in v2.2.0

func IsCreatedByUser(share link.PublicShare, user *user.User) bool

IsCreatedByUser checks if a share was created by the user.

func IsExpired

func IsExpired(s link.PublicShare) bool

IsExpired tests whether a public share is expired

func IsWriteable added in v2.13.0

func IsWriteable(perm *link.PublicSharePermissions) bool

IsWriteable checks if the grant for a publicshare allows writes or uploads.

func MatchesAnyFilter

func MatchesAnyFilter(share link.PublicShare, filters []*link.ListPublicSharesRequest_Filter) bool

MatchesAnyFilter checks if the share passes at least one of the given filters.

func MatchesFilter

func MatchesFilter(share link.PublicShare, filter *link.ListPublicSharesRequest_Filter) bool

MatchesFilter tests if the share passes the filter.

func MatchesFilters

func MatchesFilters(share link.PublicShare, filters []*link.ListPublicSharesRequest_Filter) bool

MatchesFilters checks if the share passes the given filters. Filters of the same type form a disjuntion, a logical OR. Filters of separate type form a conjunction, a logical AND. Here is an example: (resource_id=1 OR resource_id=2) AND (grantee_type=USER OR grantee_type=GROUP)

func ResourceIDFilter

ResourceIDFilter is an abstraction for creating filter by resource id.

func StorageIDFilter

func StorageIDFilter(id string) *link.ListPublicSharesRequest_Filter

StorageIDFilter is an abstraction for creating filter by storage id.

Types

type DumpableManager added in v2.6.0

type DumpableManager interface {
	Dump(ctx context.Context, shareChan chan<- *WithPassword) error
}

DumpableManager defines a share manager which supports dumping its contents

type LoadableManager added in v2.6.0

type LoadableManager interface {
	Load(ctx context.Context, shareChan <-chan *WithPassword) error
}

LoadableManager defines a share manager which supports loading contents from a dump

type Manager

type Manager interface {
	CreatePublicShare(ctx context.Context, u *user.User, md *provider.ResourceInfo, g *link.Grant) (*link.PublicShare, error)
	UpdatePublicShare(ctx context.Context, u *user.User, req *link.UpdatePublicShareRequest) (*link.PublicShare, error)
	GetPublicShare(ctx context.Context, u *user.User, ref *link.PublicShareReference, sign bool) (*link.PublicShare, error)
	ListPublicShares(ctx context.Context, u *user.User, filters []*link.ListPublicSharesRequest_Filter, sign bool) ([]*link.PublicShare, error)
	RevokePublicShare(ctx context.Context, u *user.User, ref *link.PublicShareReference) error
	GetPublicShareByToken(ctx context.Context, token string, auth *link.PublicShareAuthentication, sign bool) (*link.PublicShare, error)
}

Manager manipulates public shares.

type WithPassword added in v2.6.0

type WithPassword struct {
	Password    string `json:"password"`
	PublicShare link.PublicShare
}

WithPassword holds the relevant information for representing a public share

Directories

Path Synopsis
manager
cs3
owncloudsql
Package owncloudsql implements a publiclink share manager backed by an existing ownCloud 10 database
Package owncloudsql implements a publiclink share manager backed by an existing ownCloud 10 database

Jump to

Keyboard shortcuts

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