nextcloud

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package nextcloud verifies a clientID and clientSecret against a Nextcloud backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNextcloudServerMock

func GetNextcloudServerMock(called *[]string) http.Handler

GetNextcloudServerMock returns a handler that pretends to be a remote Nextcloud server

func New

func New(m map[string]interface{}) (share.Manager, error)

New returns a share manager implementation that verifies against a Nextcloud backend.

func TestingHTTPClient

func TestingHTTPClient(handler http.Handler) (*http.Client, func())

TestingHTTPClient thanks to https://itnext.io/how-to-stub-requests-to-remote-hosts-with-go-6c2c1db32bf2 Ideally, this function would live in tests/helpers, but if we put it there, it gets excluded by .dockerignore, and the Docker build fails (see https://github.com/cs3org/reva/issues/1999) So putting it here for now - open to suggestions if someone knows a better way to inject this.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action describes a REST request to forward to the Nextcloud backend

type GranteeAltMap

type GranteeAltMap struct {
	ID *provider.Grantee_UserId `json:"id"`
}

GranteeAltMap is an alternative map to JSON-unmarshal a Grantee Grantees are hard to unmarshal, so unmarshalling into a map[string]interface{} first, see also https://github.com/pondersource/sciencemesh-nextcloud/issues/27

type Manager added in v1.15.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the Nextcloud-based implementation of the share.Manager interface see https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func NewShareManager

func NewShareManager(c *ShareManagerConfig) (*Manager, error)

NewShareManager returns a new Nextcloud-based ShareManager

func (*Manager) GetReceivedShare added in v1.15.0

GetReceivedShare as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) GetShare added in v1.15.0

GetShare as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) ListReceivedShares added in v1.15.0

func (sm *Manager) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error)

ListReceivedShares as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) ListShares added in v1.15.0

func (sm *Manager) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error)

ListShares as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) SetHTTPClient added in v1.15.0

func (sm *Manager) SetHTTPClient(c *http.Client)

SetHTTPClient sets the HTTP client

func (*Manager) Share added in v1.15.0

Share as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) Unshare added in v1.15.0

func (sm *Manager) Unshare(ctx context.Context, ref *collaboration.ShareReference) error

Unshare as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (Manager) UpdateReceivedShare added in v1.15.0

func (sm Manager) UpdateReceivedShare(ctx context.Context, receivedShare *collaboration.ReceivedShare, fieldMask *field_mask.FieldMask) (*collaboration.ReceivedShare, error)

UpdateReceivedShare as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

func (*Manager) UpdateShare added in v1.15.0

UpdateShare as defined in the share.Manager interface https://github.com/cs3org/reva/blob/v1.13.0/pkg/share/share.go#L29-L54

type ReceivedShareAltMap

type ReceivedShareAltMap struct {
	Share *ShareAltMap             `json:"share"`
	State collaboration.ShareState `json:"state"`
}

ReceivedShareAltMap is an alternative map to JSON-unmarshal a ReceivedShare

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response contains data for the Nextcloud mock server to respond and to switch to a new server state

type ShareAltMap

type ShareAltMap struct {
	ID          *collaboration.ShareId          `json:"id"`
	ResourceID  *provider.ResourceId            `json:"resource_id"`
	Permissions *collaboration.SharePermissions `json:"permissions"`
	Grantee     *GranteeAltMap                  `json:"grantee"`
	Owner       *userpb.UserId                  `json:"owner"`
	Creator     *userpb.UserId                  `json:"creator"`
	Ctime       *types.Timestamp                `json:"ctime"`
	Mtime       *types.Timestamp                `json:"mtime"`
}

ShareAltMap is an alternative map to JSON-unmarshal a Share

type ShareManagerConfig

type ShareManagerConfig struct {
	EndPoint string `mapstructure:"endpoint" docs:";The Nextcloud backend endpoint for user check"`
	MockHTTP bool   `mapstructure:"mock_http"`
}

ShareManagerConfig contains config for a Nextcloud-based ShareManager

Jump to

Keyboard shortcuts

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