Documentation ¶
Index ¶
- Constants
- func FilterFiltersByType(f []*collaboration.Filter, t collaboration.Filter_Type) []*collaboration.Filter
- func GroupFiltersByType(filters []*collaboration.Filter) map[collaboration.Filter_Type][]*collaboration.Filter
- func GroupGranteeFilter() *collaboration.Filter
- func IsCreatedByUser(share *collaboration.Share, user *userv1beta1.User) bool
- func IsExpired(s *collaboration.Share) bool
- func IsGrantedToUser(share *collaboration.Share, user *userv1beta1.User) bool
- func MatchesAnyFilter(share *collaboration.Share, state collaboration.ShareState, ...) bool
- func MatchesFilter(share *collaboration.Share, state collaboration.ShareState, ...) bool
- func MatchesFilters(share *collaboration.Share, filters []*collaboration.Filter) bool
- func MatchesFiltersWithState(share *collaboration.Share, state collaboration.ShareState, ...) bool
- func ResourceIDFilter(id *provider.ResourceId) *collaboration.Filter
- func SpaceIDFilter(id string) *collaboration.Filter
- func StateFilter(state collaboration.ShareState) *collaboration.Filter
- func UserGranteeFilter() *collaboration.Filter
- type DumpableManager
- type LoadableManager
- type Manager
- type Metadata
- type ReceivedShareWithUser
Constants ¶
const ( // NoState can be used to signal the filter matching functions to ignore the share state. NoState collaboration.ShareState = -1 )
Variables ¶
This section is empty.
Functions ¶
func FilterFiltersByType ¶ added in v2.9.0
func FilterFiltersByType(f []*collaboration.Filter, t collaboration.Filter_Type) []*collaboration.Filter
FilterFiltersByType returns a slice of filters by a given type. If no filter with the given type exists within the filters, then an empty slice is returned.
func GroupFiltersByType ¶
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 ¶
func GroupGranteeFilter() *collaboration.Filter
GroupGranteeFilter is an abstraction for creating filter by grantee type group.
func IsCreatedByUser ¶
func IsCreatedByUser(share *collaboration.Share, user *userv1beta1.User) bool
IsCreatedByUser checks if the user is the owner or creator of the share.
func IsExpired ¶ added in v2.13.0
func IsExpired(s *collaboration.Share) bool
IsExpired tests whether a share is expired
func IsGrantedToUser ¶
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 ¶
func MatchesAnyFilter(share *collaboration.Share, state collaboration.ShareState, filters []*collaboration.Filter) bool
MatchesAnyFilter checks if the share passes at least one of the given filters.
func MatchesFilter ¶
func MatchesFilter(share *collaboration.Share, state collaboration.ShareState, filter *collaboration.Filter) bool
MatchesFilter tests if the share passes the filter.
func MatchesFilters ¶
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 MatchesFiltersWithState ¶ added in v2.11.0
func MatchesFiltersWithState(share *collaboration.Share, state collaboration.ShareState, filters []*collaboration.Filter) bool
MatchesFiltersWithState checks if the share passes the given filters. This can check filter by share state 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 ¶
func ResourceIDFilter(id *provider.ResourceId) *collaboration.Filter
ResourceIDFilter is an abstraction for creating filter by resource id.
func SpaceIDFilter ¶ added in v2.7.0
func SpaceIDFilter(id string) *collaboration.Filter
SpaceIDFilter is an abstraction for creating filter by space id.
func StateFilter ¶ added in v2.11.0
func StateFilter(state collaboration.ShareState) *collaboration.Filter
StateFilter is an abstraction for creating filter by share state.
func UserGranteeFilter ¶
func UserGranteeFilter() *collaboration.Filter
UserGranteeFilter is an abstraction for creating filter by grantee type user.
Types ¶
type DumpableManager ¶ added in v2.6.0
type DumpableManager interface {
Dump(ctx context.Context, shareChan chan<- *collaboration.Share, receivedShareChan chan<- ReceivedShareWithUser) 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 *collaboration.Share, receivedShareChan <-chan ReceivedShareWithUser) error
}
LoadableManager defines a share manager which supports loading contents from a dump
type Manager ¶
type Manager interface { context.Context, md *provider.ResourceInfo, g *collaboration.ShareGrant) (*collaboration.Share, error) GetShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.Share, error) Unshare(ctx context.Context, ref *collaboration.ShareReference) error UpdateShare(ctx context.Context, ref *collaboration.ShareReference, p *collaboration.SharePermissions, updated *collaboration.Share, fieldMask *field_mask.FieldMask) (*collaboration.Share, error) // it returns only shares attached to the given resource. ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter, forUser *userv1beta1.UserId) ([]*collaboration.ReceivedShare, error) GetReceivedShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.ReceivedShare, error) UpdateReceivedShare(ctx context.Context, share *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask, forUser *userv1beta1.UserId) (*collaboration.ReceivedShare, error) }Share(ctx
Manager is the interface that manipulates shares.
type ReceivedShareWithUser ¶ added in v2.6.0
type ReceivedShareWithUser struct {}
ReceivedShareWithUser holds the relevant information for representing a received share of a user