share

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

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 GroupFiltersByType added in v0.0.2

func GroupFiltersByType(filters []*collaboration.Filter) map[collaboration.Filter_Type][]*collaboration.Filter

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

func GroupGranteeFilter added in v0.0.2

func GroupGranteeFilter() *collaboration.Filter

GroupGranteeFilter is an abstraction for creating filter by grantee type group.

func IsCreatedByUser added in v0.0.2

func IsCreatedByUser(share *collaboration.Share, user *userv1beta1.User) bool

IsCreatedByUser checks if the user is the owner or creator of the share.

func IsGrantedToUser added in v0.0.2

func IsGrantedToUser(share *collaboration.Share, user *userv1beta1.User) bool

IsGrantedToUser checks if the user is a grantee of the share. Either by a user grant or by a group grant.

func MatchesAnyFilter added in v0.0.2

func MatchesAnyFilter(share *collaboration.Share, filters []*collaboration.Filter) bool

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

func MatchesFilter added in v0.0.2

func MatchesFilter(share *collaboration.Share, filter *collaboration.Filter) bool

MatchesFilter tests if the share passes the filter.

func MatchesFilters added in v0.0.2

func MatchesFilters(share *collaboration.Share, filters []*collaboration.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 added in v0.0.2

func ResourceIDFilter(id *provider.ResourceId) *collaboration.Filter

ResourceIDFilter is an abstraction for creating filter by resource id.

func UserGranteeFilter added in v0.0.2

func UserGranteeFilter() *collaboration.Filter

UserGranteeFilter is an abstraction for creating filter by grantee type user.

Types

type Manager

type Manager interface {
	// Create a new share in fn with the given acl.
	Share(ctx context.Context, md *provider.ResourceInfo, g *collaboration.ShareGrant) (*collaboration.Share, error)

	// GetShare gets the information for a share by the given ref.
	GetShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.Share, error)

	// Unshare deletes the share pointed by ref.
	Unshare(ctx context.Context, ref *collaboration.ShareReference) error

	// UpdateShare updates the mode of the given share.
	UpdateShare(ctx context.Context, ref *collaboration.ShareReference, p *collaboration.SharePermissions) (*collaboration.Share, error)

	// ListShares returns the shares created by the user. If md is provided is not nil,
	// it returns only shares attached to the given resource.
	ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error)

	// ListReceivedShares returns the list of shares the user has access to.
	ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error)

	// GetReceivedShare returns the information for a received share.
	GetReceivedShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.ReceivedShare, error)

	// UpdateReceivedShare updates the received share with share state.
	UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error)
}

Manager is the interface that manipulates shares.

Directories

Path Synopsis
manager

Jump to

Keyboard shortcuts

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