svc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 91 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown permissionType = iota
	Public
	User
	Space
	OCM
)
View Source
const (
	// ReadmeSpecialFolderName for the drive specialFolder property
	ReadmeSpecialFolderName = "readme"
	// SpaceImageSpecialFolderName for the drive specialFolder property
	SpaceImageSpecialFolderName = "image"
)
View Source
const (
	// HeaderPurge defines the header name for the purge header.
	HeaderPurge = "Purge"
)

Variables

View Source
var (
	// ErrNoUpdates is returned when no updates are provided
	ErrNoUpdates = errors.New("no updates")

	// ErrNoUpdater is returned when no updater is provided
	ErrNoUpdater = errors.New("no updater")

	// ErrAbsoluteNamePath is returned when the name is an absolute path
	ErrAbsoluteNamePath = errors.New("name cannot be an absolute path")

	// ErrNotAShareJail is returned when the driveID does not belong to a share jail
	ErrNotAShareJail = errorcode.New(errorcode.InvalidRequest, "id does not belong to a share jail")

	// ErrInvalidDriveIDOrItemID is returned when the driveID or itemID is invalid
	ErrInvalidDriveIDOrItemID = errorcode.New(errorcode.InvalidRequest, "invalid driveID or itemID")

	// ErrInvalidRequestBody is returned when the request body is invalid
	ErrInvalidRequestBody = errorcode.New(errorcode.InvalidRequest, "invalid request body")

	// ErrUnmountShare is returned when unmounting a share fails
	ErrUnmountShare = errorcode.New(errorcode.InvalidRequest, "unmounting share failed")

	// ErrMountShare is returned when mounting a share fails
	ErrMountShare = errorcode.New(errorcode.InvalidRequest, "mounting share failed")

	// ErrUpdateShares is returned when updating shares fails
	ErrUpdateShares = errorcode.New(errorcode.InvalidRequest, "failed to update share")

	// ErrInvalidID is returned when the id is invalid
	ErrInvalidID = errorcode.New(errorcode.InvalidRequest, "invalid id")

	// ErrDriveItemConversion is returned when converting to drive items fails
	ErrDriveItemConversion = errorcode.New(errorcode.InvalidRequest, "converting to drive items failed")

	// ErrNoShares is returned when no shares are found
	ErrNoShares = errorcode.New(errorcode.ItemNotFound, "no shares found")

	// ErrAlreadyMounted is returned when all shares are already mounted
	ErrAlreadyMounted = errorcode.New(errorcode.NameAlreadyExists, "shares already mounted")

	// ErrAlreadyUnmounted is returned when all shares are already unmounted
	ErrAlreadyUnmounted = errorcode.New(errorcode.NameAlreadyExists, "shares already unmounted")
)
View Source
var (
	// ErrUnmountOCMShare is returned when unmounting a share fails
	ErrUnmountOCMShare = errorcode.New(errorcode.InvalidRequest, "unmounting ocm share failed")

	// ErrMountOCMShare is returned when mounting a share fails
	ErrMountOCMShare = errorcode.New(errorcode.InvalidRequest, "mounting ocm share failed")
)
View Source
var (

	// ErrNameTooLong is thrown when the spacename is too long
	ErrNameTooLong = fmt.Errorf("spacename must be smaller than %d", _maxSpaceNameLength)

	// ErrNameEmpty is thrown when the spacename is empty
	ErrNameEmpty = errors.New("spacename must not be empty")

	// ErrForbiddenCharacter is thrown when the spacename contains an invalid character
	ErrForbiddenCharacter = fmt.Errorf("spacenames must not contain %v", _invalidSpaceNameCharacters)
)
View Source
var (

	// HeaderAcceptLanguage is the header key for the accept-language header
	HeaderAcceptLanguage = "Accept-Language"

	// TemplateParameter is the key for the template parameter in the request
	TemplateParameter = "template"
)
View Source
var (

	// TokenTransportHeader holds the header key for the reva transfer token
	TokenTransportHeader = "X-Reva-Transfer"
)

Functions

func ExtractShareIdFromResourceId

func ExtractShareIdFromResourceId(rid *storageprovider.ResourceId) *collaboration.ShareId

ExtractShareIdFromResourceId is a bit of a hack. We should not rely on a specific format of the item id. But currently there is no other way to get the ShareID.

func GetDriveAndItemIDParam

func GetDriveAndItemIDParam(r *http.Request, logger *log.Logger) (*storageprovider.ResourceId, *storageprovider.ResourceId, error)

GetDriveAndItemIDParam parses the driveID and itemID from the request, validates the common fields and returns the parsed IDs if ok.

func GetFilterParam

func GetFilterParam(r *http.Request) string

GetFilterParam returns the $filter query parameter from the request. If you need to parse the filter use godata.ParseRequest

func GetSelectParam

func GetSelectParam(r *http.Request) string

GetSelectParam returns the $select query parameter from the request. If you need to parse the select filter use godata.ParseRequest

func IsShareJail

func IsShareJail(id *storageprovider.ResourceId) bool

IsShareJail returns true if given id is a share jail id.

func IsSpaceRoot

func IsSpaceRoot(rid *storageprovider.ResourceId) bool

IsSpaceRoot returns true if the resourceID is a space root.

func StrictJSONUnmarshal

func StrictJSONUnmarshal(r io.Reader, v interface{}) error

StrictJSONUnmarshal is a wrapper around json.Unmarshal that returns an error if the json contains unknown fields.

Types

type APIVersion

type APIVersion int
const (
	// APIVersion_1 represents the first version of the API.
	APIVersion_1 APIVersion = iota + 1

	// APIVersion_1_Beta_1 refers to the beta version of the API.
	// It is typically used for testing purposes and may have more
	// inconsistencies and bugs than the stable version as it is
	// still in the testing phase, use it with caution.
	APIVersion_1_Beta_1
)

type BaseGraphProvider

type BaseGraphProvider interface {
	CS3ReceivedSharesToDriveItems(ctx context.Context, receivedShares []*collaboration.ReceivedShare) ([]libregraph.DriveItem, error)
	CS3ReceivedOCMSharesToDriveItems(ctx context.Context, receivedOCMShares []*ocm.ReceivedShare) ([]libregraph.DriveItem, error)
}

BaseGraphProvider is the interface that wraps shared methods between the different graph providers

type BaseGraphService

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

BaseGraphService implements a couple of helper functions that are shared between the different graph services

func (BaseGraphService) CS3ReceivedOCMSharesToDriveItems

func (g BaseGraphService) CS3ReceivedOCMSharesToDriveItems(ctx context.Context, receivedShares []*ocm.ReceivedShare) ([]libregraph.DriveItem, error)

func (BaseGraphService) CS3ReceivedSharesToDriveItems

func (g BaseGraphService) CS3ReceivedSharesToDriveItems(ctx context.Context, receivedShares []*collaboration.ReceivedShare) ([]libregraph.DriveItem, error)

type DriveItemPermissionsApi

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

DriveItemPermissionsApi is the api that registers the http endpoints which expose needed operation to the graph api. the business logic is delegated to the permissions service and further down to the cs3 client.

func NewDriveItemPermissionsApi

func NewDriveItemPermissionsApi(driveItemPermissionService DriveItemPermissionsProvider, logger log.Logger, c *config.Config) (DriveItemPermissionsApi, error)

NewDriveItemPermissionsApi creates a new DriveItemPermissionsApi

func (api DriveItemPermissionsApi) CreateLink(w http.ResponseWriter, r *http.Request)

CreateLink creates a public link on the cs3 api

func (api DriveItemPermissionsApi) CreateSpaceRootLink(w http.ResponseWriter, r *http.Request)

func (DriveItemPermissionsApi) DeletePermission

func (api DriveItemPermissionsApi) DeletePermission(w http.ResponseWriter, r *http.Request)

DeletePermission handles DeletePermission requests

func (DriveItemPermissionsApi) DeleteSpaceRootPermission

func (api DriveItemPermissionsApi) DeleteSpaceRootPermission(w http.ResponseWriter, r *http.Request)

DeleteSpaceRootPermission handles DeletePermission requests on a space root

func (DriveItemPermissionsApi) Invite

Invite handles DriveItemInvite requests

func (DriveItemPermissionsApi) ListPermissions

func (api DriveItemPermissionsApi) ListPermissions(w http.ResponseWriter, r *http.Request)

ListPermissions handles ListPermissions requests

func (DriveItemPermissionsApi) ListSpaceRootPermissions

func (api DriveItemPermissionsApi) ListSpaceRootPermissions(w http.ResponseWriter, r *http.Request)

ListSpaceRootPermissions handles ListPermissions requests on a space root

func (DriveItemPermissionsApi) SetLinkPassword

func (api DriveItemPermissionsApi) SetLinkPassword(w http.ResponseWriter, r *http.Request)

SetLinkPassword sets public link password on the cs3 api

func (DriveItemPermissionsApi) SetSpaceRootLinkPassword

func (api DriveItemPermissionsApi) SetSpaceRootLinkPassword(w http.ResponseWriter, r *http.Request)

func (DriveItemPermissionsApi) SpaceRootInvite

func (api DriveItemPermissionsApi) SpaceRootInvite(w http.ResponseWriter, r *http.Request)

SpaceRootInvite handles DriveItemInvite requests on a space root

func (DriveItemPermissionsApi) UpdatePermission

func (api DriveItemPermissionsApi) UpdatePermission(w http.ResponseWriter, r *http.Request)

UpdatePermission handles UpdatePermission requests

func (DriveItemPermissionsApi) UpdateSpaceRootPermission

func (api DriveItemPermissionsApi) UpdateSpaceRootPermission(w http.ResponseWriter, r *http.Request)

UpdateSpaceRootPermission handles UpdatePermission requests on a space root

type DriveItemPermissionsProvider

type DriveItemPermissionsProvider interface {
	Invite(ctx context.Context, resourceId *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error)
	SpaceRootInvite(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error)
	ListPermissions(ctx context.Context, itemID *storageprovider.ResourceId, listFederatedRoles, selectRoles bool) (libregraph.CollectionOfPermissionsWithAllowedValues, error)
	ListSpaceRootPermissions(ctx context.Context, driveID *storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)
	DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) error
	DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error
	UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)
	UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)
	CreateLink(ctx context.Context, driveItemID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error)
	CreateSpaceRootLink(ctx context.Context, driveID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error)
	SetPublicLinkPassword(ctx context.Context, driveItemID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)
	SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)
}

DriveItemPermissionsProvider contains the methods related to handling permissions on drive items

type DriveItemPermissionsService

type DriveItemPermissionsService struct {
	BaseGraphService
}

DriveItemPermissionsService contains the production business logic for everything that relates to permissions on drive items.

func NewDriveItemPermissionsService

func NewDriveItemPermissionsService(logger log.Logger, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], identityCache identity.IdentityCache, config *config.Config) (DriveItemPermissionsService, error)

NewDriveItemPermissionsService creates a new DriveItemPermissionsService

func (DriveItemPermissionsService) DeletePermission

func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) error

DeletePermission deletes a permission from a drive item

func (DriveItemPermissionsService) DeleteSpaceRootPermission

func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error

DeleteSpaceRootPermission deletes a permission on the root item of a project space

func (DriveItemPermissionsService) Invite

Invite invites a user to a drive item.

func (DriveItemPermissionsService) ListPermissions

func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID *storageprovider.ResourceId, listFederatedRoles, selectRoles bool) (libregraph.CollectionOfPermissionsWithAllowedValues, error)

ListPermissions lists the permissions of a driveItem

func (DriveItemPermissionsService) ListSpaceRootPermissions

ListSpaceRootPermissions handles ListPermissions request on project spaces

func (DriveItemPermissionsService) SetPublicLinkPassword

func (s DriveItemPermissionsService) SetPublicLinkPassword(ctx context.Context, driveItemId *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)

func (DriveItemPermissionsService) SetPublicLinkPasswordOnSpaceRoot

func (s DriveItemPermissionsService) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)

func (DriveItemPermissionsService) SpaceRootInvite

SpaceRootInvite handles invitation request on project spaces

func (DriveItemPermissionsService) UpdatePermission

func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)

UpdatePermission updates a permission on a drive item

func (DriveItemPermissionsService) UpdateSpaceRootPermission

func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)

UpdateSpaceRootPermission updates a permission on the root item of a project space

type DrivesDriveItemApi

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

DrivesDriveItemApi is the api that registers the http endpoints which expose needed operation to the graph api. the business logic is delegated to the space service and further down to the cs3 client.

func NewDrivesDriveItemApi

func NewDrivesDriveItemApi(drivesDriveItemService DrivesDriveItemProvider, baseGraphService BaseGraphProvider, logger log.Logger) (DrivesDriveItemApi, error)

NewDrivesDriveItemApi creates a new DrivesDriveItemApi

func (DrivesDriveItemApi) CreateDriveItem

func (api DrivesDriveItemApi) CreateDriveItem(w http.ResponseWriter, r *http.Request)

CreateDriveItem creates a drive item

func (DrivesDriveItemApi) DeleteDriveItem

func (api DrivesDriveItemApi) DeleteDriveItem(w http.ResponseWriter, r *http.Request)

DeleteDriveItem deletes a drive item

func (DrivesDriveItemApi) GetDriveItem

func (api DrivesDriveItemApi) GetDriveItem(w http.ResponseWriter, r *http.Request)

GetDriveItem get a drive item

func (DrivesDriveItemApi) UpdateDriveItem

func (api DrivesDriveItemApi) UpdateDriveItem(w http.ResponseWriter, r *http.Request)

UpdateDriveItem updates a drive item, currently only the visibility of the share is updated

type DrivesDriveItemProvider

type DrivesDriveItemProvider interface {
	// MountShare mounts a share
	MountShare(ctx context.Context, resourceID *storageprovider.ResourceId, name string) ([]*collaboration.ReceivedShare, error)

	// MountOCMShare mounts an OCM share
	MountOCMShare(ctx context.Context, resourceID *storageprovider.ResourceId) ([]*ocm.ReceivedShare, error)

	// UnmountShare unmounts a share
	UnmountShare(ctx context.Context, shareID *collaboration.ShareId) error

	// UpdateShares updates multiple shares
	UpdateShares(ctx context.Context, shares []*collaboration.ReceivedShare, updater UpdateShareClosure) ([]*collaboration.ReceivedShare, error)

	// GetShare returns the share
	GetShare(ctx context.Context, shareID *collaboration.ShareId) (*collaboration.ReceivedShare, error)

	// GetSharesForResource returns all shares for a given resourceID
	GetSharesForResource(ctx context.Context, resourceID *storageprovider.ResourceId, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error)
}

DrivesDriveItemProvider is the interface that needs to be implemented by the individual space service

type DrivesDriveItemService

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

DrivesDriveItemService contains the production business logic for everything that relates to drives

func NewDrivesDriveItemService

func NewDrivesDriveItemService(logger log.Logger, gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) (DrivesDriveItemService, error)

NewDrivesDriveItemService creates a new DrivesDriveItemService

func (DrivesDriveItemService) GetOCMSharesForResource

func (s DrivesDriveItemService) GetOCMSharesForResource(ctx context.Context, resourceID *storageprovider.ResourceId) ([]*ocm.ReceivedShare, error)

GetOCMSharesForResource returns all federated shares for a given resourceID

func (DrivesDriveItemService) GetShare

func (DrivesDriveItemService) GetSharesForResource

func (s DrivesDriveItemService) GetSharesForResource(ctx context.Context, resourceID *storageprovider.ResourceId, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error)

GetSharesForResource returns all shares for a given resourceID

func (DrivesDriveItemService) MountOCMShare

func (s DrivesDriveItemService) MountOCMShare(ctx context.Context, resourceID *storageprovider.ResourceId) ([]*ocm.ReceivedShare, error)

func (DrivesDriveItemService) MountShare

MountShare mounts a share, there is no guarantee that all siblings will be mounted in some rare cases it could happen that none of the siblings could be mounted, then the error will be returned

func (DrivesDriveItemService) UnmountShare

func (s DrivesDriveItemService) UnmountShare(ctx context.Context, shareID *collaboration.ShareId) error

UnmountShare unmounts a share

func (DrivesDriveItemService) UpdateOCMShare

func (s DrivesDriveItemService) UpdateOCMShare(ctx context.Context, share *ocm.ReceivedShare, updater UpdateOCMShareClosure) error

UpdateOCMShare updates a single share

func (DrivesDriveItemService) UpdateOCMShares

func (s DrivesDriveItemService) UpdateOCMShares(ctx context.Context, shares []*ocm.ReceivedShare, updater UpdateOCMShareClosure) ([]*ocm.ReceivedShare, error)

UpdateShares updates multiple shares; it could happen that some shares are updated and some are not, this will return a list of updated shares and a list of errors; there is no guarantee that all updates are successful

func (DrivesDriveItemService) UpdateShare

UpdateShare updates a single share

func (DrivesDriveItemService) UpdateShares

UpdateShares updates multiple shares; it could happen that some shares are updated and some are not, this will return a list of updated shares and a list of errors; there is no guarantee that all updates are successful

type ExportPersonalDataRequest

type ExportPersonalDataRequest struct {
	StorageLocation string `json:"storageLocation"`
}

ExportPersonalDataRequest is the body of the request

type GetGatewayServiceClientFunc

type GetGatewayServiceClientFunc func() (gateway.GatewayAPIClient, error)

GetGatewayServiceClientFunc is a callback used to pass in a mock during testing

type Graph

type Graph struct {
	BaseGraphService
	// contains filtered or unexported fields
}

Graph defines implements the business logic for Service.

func NewService

func NewService(opts ...Option) (Graph, error)

NewService returns a service implementation for Service.

func (Graph) AssignTags

func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request)

AssignTags assigns a tag to a resource

func (Graph) ChangeOwnPassword

func (g Graph) ChangeOwnPassword(w http.ResponseWriter, r *http.Request)

ChangeOwnPassword implements the Service interface. It allows the user to change its own password

func (Graph) CreateAppRoleAssignment

func (g Graph) CreateAppRoleAssignment(w http.ResponseWriter, r *http.Request)

CreateAppRoleAssignment implements the Service interface.

func (Graph) CreateDrive

func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request)

CreateDrive creates a storage drive (space).

func (Graph) CreateUploadSession

func (g Graph) CreateUploadSession(w http.ResponseWriter, r *http.Request)

CreateUploadSession create an upload session to allow your app to upload files up to the maximum file size. An upload session allows your app to upload ranges of the file in sequential API requests, which allows the transfer to be resumed if a connection is dropped while the upload is in progress. ```json

{
  "@microsoft.graph.conflictBehavior": "fail (default) | replace | rename",
  "description": "description",
  "fileSize": 1234,
  "name": "filename.txt"
}

``` From https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

func (Graph) DeleteAppRoleAssignment

func (g Graph) DeleteAppRoleAssignment(w http.ResponseWriter, r *http.Request)

DeleteAppRoleAssignment implements the Service interface.

func (Graph) DeleteDrive

func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request)

DeleteDrive deletes a storage drive (space).

func (Graph) DeleteEducationClass

func (g Graph) DeleteEducationClass(w http.ResponseWriter, r *http.Request)

DeleteEducationClass implements the Service interface.

func (Graph) DeleteEducationClassMember

func (g Graph) DeleteEducationClassMember(w http.ResponseWriter, r *http.Request)

DeleteEducationClassMember implements the Service interface.

func (Graph) DeleteEducationClassTeacher

func (g Graph) DeleteEducationClassTeacher(w http.ResponseWriter, r *http.Request)

DeleteEducationClassTeacher implements the Service interface.

func (Graph) DeleteEducationSchool

func (g Graph) DeleteEducationSchool(w http.ResponseWriter, r *http.Request)

DeleteEducationSchool implements the Service interface.

func (Graph) DeleteEducationSchoolClass

func (g Graph) DeleteEducationSchoolClass(w http.ResponseWriter, r *http.Request)

DeleteEducationSchoolClass implements the Service interface.

func (Graph) DeleteEducationSchoolUser

func (g Graph) DeleteEducationSchoolUser(w http.ResponseWriter, r *http.Request)

DeleteEducationSchoolUser implements the Service interface.

func (Graph) DeleteEducationUser

func (g Graph) DeleteEducationUser(w http.ResponseWriter, r *http.Request)

DeleteEducationUser implements the Service interface.

func (Graph) DeleteGroup

func (g Graph) DeleteGroup(w http.ResponseWriter, r *http.Request)

DeleteGroup implements the Service interface.

func (Graph) DeleteGroupMember

func (g Graph) DeleteGroupMember(w http.ResponseWriter, r *http.Request)

DeleteGroupMember implements the Service interface.

func (Graph) DeleteUser

func (g Graph) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser implements the Service interface.

func (Graph) ExportPersonalData

func (g Graph) ExportPersonalData(w http.ResponseWriter, r *http.Request)

ExportPersonalData exports all personal data the system holds

func (Graph) GatherPersonalData

func (g Graph) GatherPersonalData(usr *user.User, ref *provider.Reference, token string, marsh Marshaller)

GatherPersonalData will all gather all personal data of the user and save it to a file in the users personal space

func (Graph) GetAllDrives

func (g Graph) GetAllDrives(version APIVersion) http.HandlerFunc

GetAllDrives serves as a factory method that returns the appropriate http.Handler function based on the specified API version.

func (Graph) GetAllDrivesV1

func (g Graph) GetAllDrivesV1(w http.ResponseWriter, r *http.Request)

GetAllDrivesV1 attempts to retrieve the current users drives; it includes another user's drives, if the current user has the permission.

func (Graph) GetAllDrivesV1Beta1

func (g Graph) GetAllDrivesV1Beta1(w http.ResponseWriter, r *http.Request)

GetAllDrivesV1Beta1 is the same as the GetAllDrivesV1 endpoint, expect: it includes the grantedtoV2 property it uses unified roles instead of the cs3 representations

func (Graph) GetApplication

func (g Graph) GetApplication(w http.ResponseWriter, r *http.Request)

GetApplication implements the Service interface.

func (Graph) GetDriveItem

func (g Graph) GetDriveItem(w http.ResponseWriter, r *http.Request)

GetDriveItem returns a driveItem

func (Graph) GetDriveItemChildren

func (g Graph) GetDriveItemChildren(w http.ResponseWriter, r *http.Request)

GetDriveItemChildren lists the children of a driveItem

func (Graph) GetDrives

func (g Graph) GetDrives(version APIVersion) http.HandlerFunc

GetDrives serves as a factory method that returns the appropriate http.Handler function based on the specified API version.

func (Graph) GetDrivesV1

func (g Graph) GetDrivesV1(w http.ResponseWriter, r *http.Request)

GetDrivesV1 attempts to retrieve the current users drives; it lists all drives the current user has access to.

func (Graph) GetDrivesV1Beta1

func (g Graph) GetDrivesV1Beta1(w http.ResponseWriter, r *http.Request)

GetDrivesV1Beta1 is the same as the GetDrivesV1 endpoint, expect: it includes the grantedtoV2 property it uses unified roles instead of the cs3 representations

func (Graph) GetEducationClass

func (g Graph) GetEducationClass(w http.ResponseWriter, r *http.Request)

GetEducationClass implements the Service interface.

func (Graph) GetEducationClassMembers

func (g Graph) GetEducationClassMembers(w http.ResponseWriter, r *http.Request)

GetEducationClassMembers implements the Service interface.

func (Graph) GetEducationClassTeachers

func (g Graph) GetEducationClassTeachers(w http.ResponseWriter, r *http.Request)

GetEducationClassTeachers implements the Service interface.

func (Graph) GetEducationClasses

func (g Graph) GetEducationClasses(w http.ResponseWriter, r *http.Request)

GetEducationClasses implements the Service interface.

func (Graph) GetEducationSchool

func (g Graph) GetEducationSchool(w http.ResponseWriter, r *http.Request)

GetEducationSchool implements the Service interface.

func (Graph) GetEducationSchoolClasses

func (g Graph) GetEducationSchoolClasses(w http.ResponseWriter, r *http.Request)

GetEducationSchoolClasses implements the Service interface.

func (Graph) GetEducationSchoolUsers

func (g Graph) GetEducationSchoolUsers(w http.ResponseWriter, r *http.Request)

GetEducationSchoolUsers implements the Service interface.

func (Graph) GetEducationSchools

func (g Graph) GetEducationSchools(w http.ResponseWriter, r *http.Request)

GetEducationSchools implements the Service interface.

func (Graph) GetEducationUser

func (g Graph) GetEducationUser(w http.ResponseWriter, r *http.Request)

GetEducationUser implements the Service interface.

func (Graph) GetEducationUsers

func (g Graph) GetEducationUsers(w http.ResponseWriter, r *http.Request)

GetEducationUsers implements the Service interface.

func (Graph) GetGatewayClient

func (g Graph) GetGatewayClient(w http.ResponseWriter, r *http.Request) (gateway.GatewayAPIClient, bool)

GetGatewayClient returns a gateway client from the gatewaySelector.

func (Graph) GetGroup

func (g Graph) GetGroup(w http.ResponseWriter, r *http.Request)

GetGroup implements the Service interface.

func (Graph) GetGroupMembers

func (g Graph) GetGroupMembers(w http.ResponseWriter, r *http.Request)

GetGroupMembers implements the Service interface.

func (Graph) GetGroups

func (g Graph) GetGroups(w http.ResponseWriter, r *http.Request)

GetGroups implements the Service interface.

func (Graph) GetMe

func (g Graph) GetMe(w http.ResponseWriter, r *http.Request)

GetMe implements the Service interface.

func (Graph) GetRoleDefinition

func (g Graph) GetRoleDefinition(w http.ResponseWriter, r *http.Request)

GetRoleDefinition a permission role than can be used when sharing with users or groups

func (Graph) GetRoleDefinitions

func (g Graph) GetRoleDefinitions(w http.ResponseWriter, r *http.Request)

GetRoleDefinitions a list of permission roles than can be used when sharing with users or groups

func (Graph) GetRootDriveChildren

func (g Graph) GetRootDriveChildren(w http.ResponseWriter, r *http.Request)

GetRootDriveChildren implements the Service interface.

func (Graph) GetSharedByMe

func (g Graph) GetSharedByMe(w http.ResponseWriter, r *http.Request)

GetSharedByMe implements the Service interface (/me/drives/sharedByMe endpoint)

func (Graph) GetSingleDrive

func (g Graph) GetSingleDrive(w http.ResponseWriter, r *http.Request)

GetSingleDrive does a lookup of a single space by spaceId

func (Graph) GetTags

func (g Graph) GetTags(w http.ResponseWriter, r *http.Request)

GetTags returns all available tags

func (Graph) GetUser

func (g Graph) GetUser(w http.ResponseWriter, r *http.Request)

GetUser implements the Service interface.

func (Graph) GetUserDrive

func (g Graph) GetUserDrive(w http.ResponseWriter, r *http.Request)

GetUserDrive implements the Service interface.

func (Graph) GetUsers

func (g Graph) GetUsers(w http.ResponseWriter, r *http.Request)

GetUsers implements the Service interface.

func (Graph) ListAppRoleAssignments

func (g Graph) ListAppRoleAssignments(w http.ResponseWriter, r *http.Request)

ListAppRoleAssignments implements the Service interface.

func (Graph) ListApplications

func (g Graph) ListApplications(w http.ResponseWriter, r *http.Request)

ListApplications implements the Service interface.

func (Graph) ListSharedWithMe

func (g Graph) ListSharedWithMe(w http.ResponseWriter, r *http.Request)

ListSharedWithMe lists the files shared with the current user.

func (Graph) ListStorageSpacesWithFilters

func (g Graph) ListStorageSpacesWithFilters(ctx context.Context, filters []*storageprovider.ListStorageSpacesRequest_Filter, unrestricted bool) (*storageprovider.ListStorageSpacesResponse, error)

ListStorageSpacesWithFilters List Storage Spaces using filters

func (Graph) PatchEducationClass

func (g Graph) PatchEducationClass(w http.ResponseWriter, r *http.Request)

PatchEducationClass implements the Service interface.

func (Graph) PatchEducationSchool

func (g Graph) PatchEducationSchool(w http.ResponseWriter, r *http.Request)

PatchEducationSchool implements the Service interface.

func (Graph) PatchEducationUser

func (g Graph) PatchEducationUser(w http.ResponseWriter, r *http.Request)

PatchEducationUser implements the Service Interface. Updates the specified attributes of an ExistingUser

func (Graph) PatchGroup

func (g Graph) PatchGroup(w http.ResponseWriter, r *http.Request)

PatchGroup implements the Service interface.

func (Graph) PatchMe

func (g Graph) PatchMe(w http.ResponseWriter, r *http.Request)

PatchMe implements the Service Interface. Updates the specified attributes of the current user

func (Graph) PatchUser

func (g Graph) PatchUser(w http.ResponseWriter, r *http.Request)

PatchUser implements the Service Interface. Updates the specified attributes of an ExistingUser

func (Graph) PostEducationClass

func (g Graph) PostEducationClass(w http.ResponseWriter, r *http.Request)

PostEducationClass implements the Service interface.

func (Graph) PostEducationClassMember

func (g Graph) PostEducationClassMember(w http.ResponseWriter, r *http.Request)

PostEducationClassMember implements the Service interface.

func (Graph) PostEducationClassTeacher

func (g Graph) PostEducationClassTeacher(w http.ResponseWriter, r *http.Request)

PostEducationClassTeacher implements the Service interface.

func (Graph) PostEducationSchool

func (g Graph) PostEducationSchool(w http.ResponseWriter, r *http.Request)

PostEducationSchool implements the Service interface.

func (Graph) PostEducationSchoolClass

func (g Graph) PostEducationSchoolClass(w http.ResponseWriter, r *http.Request)

PostEducationSchoolClass implements the Service interface.

func (Graph) PostEducationSchoolUser

func (g Graph) PostEducationSchoolUser(w http.ResponseWriter, r *http.Request)

PostEducationSchoolUser implements the Service interface.

func (Graph) PostEducationUser

func (g Graph) PostEducationUser(w http.ResponseWriter, r *http.Request)

PostEducationUser implements the Service interface.

func (Graph) PostGroup

func (g Graph) PostGroup(w http.ResponseWriter, r *http.Request)

PostGroup implements the Service interface.

func (Graph) PostGroupMember

func (g Graph) PostGroupMember(w http.ResponseWriter, r *http.Request)

PostGroupMember implements the Service interface.

func (Graph) PostUser

func (g Graph) PostUser(w http.ResponseWriter, r *http.Request)

PostUser implements the Service interface.

func (Graph) ServeHTTP

func (g Graph) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the Service interface.

func (*Graph) StartListenForLogonEvents

func (g *Graph) StartListenForLogonEvents(ctx context.Context, l log.Logger) error

func (Graph) UnassignTags

func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request)

UnassignTags removes a tag from a resource

func (Graph) UpdateDrive

func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request)

UpdateDrive updates the properties of a storage drive (space).

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the subset of the http.Client that is being used to interact with the download gateway

type ListResponse

type ListResponse struct {
	Value interface{} `json:"value,omitempty"`
}

ListResponse is used for proper marshalling of Graph list responses

type Marshaller

type Marshaller func(any) ([]byte, error)

Marshaller is the common interface for a marshaller

type Option

type Option func(o *Options)

Option defines a single option function.

func Config

func Config(val *config.Config) Option

Config provides a function to set the config option.

func Context

func Context(ctx context.Context) Option

Context provides a function to set the context option.

func EventHistoryClient

func EventHistoryClient(val ehsvc.EventHistoryService) Option

EventHistoryClient provides a function to set the EventHistoryClient option.

func EventsConsumer

func EventsConsumer(val events.Consumer) Option

EventsConsumer provides a function to set the EventsConsumer option.

func EventsPublisher

func EventsPublisher(val events.Publisher) Option

EventsPublisher provides a function to set the EventsPublisher option.

func KeycloakClient

func KeycloakClient(val keycloak.Client) Option

KeycloakClient provides a function to set the KeycloakCient option.

func Logger

func Logger(val log.Logger) Option

Logger provides a function to set the logger option.

func Middleware

func Middleware(val ...func(http.Handler) http.Handler) Option

Middleware provides a function to set the middleware option.

func PermissionService

func PermissionService(val settingssvc.PermissionService) Option

PermissionService provides a function to set the PermissionService option.

func RoleManager

func RoleManager(val *roles.Manager) Option

RoleManager provides a function to set the RoleManager option.

func TraceProvider

func TraceProvider(val trace.TracerProvider) Option

TraceProvider provides a function to set the TraceProvider option.

func WithGatewaySelector

func WithGatewaySelector(val pool.Selectable[gateway.GatewayAPIClient]) Option

WithGatewaySelector provides a function to set the gateway client option.

func WithIdentityBackend

func WithIdentityBackend(val identity.Backend) Option

WithIdentityBackend provides a function to set the IdentityBackend option.

func WithIdentityEducationBackend

func WithIdentityEducationBackend(val identity.EducationBackend) Option

WithIdentityEducationBackend provides a function to set the IdentityEducationBackend option.

func WithRequireAdminMiddleware

func WithRequireAdminMiddleware(val func(http.Handler) http.Handler) Option

WithRequireAdminMiddleware provides a function to set the RequireAdminMiddleware option.

func WithRoleService

func WithRoleService(val RoleService) Option

WithRoleService provides a function to set the RoleService option.

func WithSearchService

func WithSearchService(val searchsvc.SearchProviderService) Option

WithSearchService provides a function to set the SearchService option.

func WithValueService

func WithValueService(val settingssvc.ValueService) Option

WithValueService provides a function to set the ValueService option.

type Options

type Options struct {
	Context                  context.Context
	Logger                   log.Logger
	Config                   *config.Config
	Middleware               []func(http.Handler) http.Handler
	RequireAdminMiddleware   func(http.Handler) http.Handler
	GatewaySelector          pool.Selectable[gateway.GatewayAPIClient]
	IdentityBackend          identity.Backend
	IdentityEducationBackend identity.EducationBackend
	RoleService              RoleService
	PermissionService        Permissions
	ValueService             settingssvc.ValueService
	RoleManager              *roles.Manager
	EventsPublisher          events.Publisher
	EventsConsumer           events.Consumer
	SearchService            searchsvc.SearchProviderService
	KeycloakClient           keycloak.Client
	EventHistoryClient       ehsvc.EventHistoryService
	TraceProvider            trace.TracerProvider
}

Options defines the available options for this package.

type Permissions

Permissions is the interface used to access the permissions service

type RoleService

RoleService is the interface used to access the role service

type Service

type Service interface {
	ServeHTTP(w http.ResponseWriter, r *http.Request)

	ListApplications(w http.ResponseWriter, r *http.Request)
	GetApplication(w http.ResponseWriter, r *http.Request)

	GetMe(w http.ResponseWriter, r *http.Request)
	GetUsers(w http.ResponseWriter, r *http.Request)
	GetUser(w http.ResponseWriter, r *http.Request)
	PostUser(w http.ResponseWriter, r *http.Request)
	DeleteUser(w http.ResponseWriter, r *http.Request)
	PatchUser(w http.ResponseWriter, r *http.Request)
	ChangeOwnPassword(w http.ResponseWriter, r *http.Request)

	ListAppRoleAssignments(w http.ResponseWriter, r *http.Request)
	CreateAppRoleAssignment(w http.ResponseWriter, r *http.Request)
	DeleteAppRoleAssignment(w http.ResponseWriter, r *http.Request)

	GetGroups(w http.ResponseWriter, r *http.Request)
	GetGroup(w http.ResponseWriter, r *http.Request)
	PostGroup(w http.ResponseWriter, r *http.Request)
	PatchGroup(w http.ResponseWriter, r *http.Request)
	DeleteGroup(w http.ResponseWriter, r *http.Request)
	GetGroupMembers(w http.ResponseWriter, r *http.Request)
	PostGroupMember(w http.ResponseWriter, r *http.Request)
	DeleteGroupMember(w http.ResponseWriter, r *http.Request)

	GetEducationSchools(w http.ResponseWriter, r *http.Request)
	GetEducationSchool(w http.ResponseWriter, r *http.Request)
	PostEducationSchool(w http.ResponseWriter, r *http.Request)
	PatchEducationSchool(w http.ResponseWriter, r *http.Request)
	DeleteEducationSchool(w http.ResponseWriter, r *http.Request)
	GetEducationSchoolUsers(w http.ResponseWriter, r *http.Request)
	PostEducationSchoolUser(w http.ResponseWriter, r *http.Request)
	DeleteEducationSchoolUser(w http.ResponseWriter, r *http.Request)
	GetEducationSchoolClasses(w http.ResponseWriter, r *http.Request)
	PostEducationSchoolClass(w http.ResponseWriter, r *http.Request)
	DeleteEducationSchoolClass(w http.ResponseWriter, r *http.Request)

	GetEducationClasses(w http.ResponseWriter, r *http.Request)
	GetEducationClass(w http.ResponseWriter, r *http.Request)
	PostEducationClass(w http.ResponseWriter, r *http.Request)
	PatchEducationClass(w http.ResponseWriter, r *http.Request)
	DeleteEducationClass(w http.ResponseWriter, r *http.Request)
	GetEducationClassMembers(w http.ResponseWriter, r *http.Request)
	PostEducationClassMember(w http.ResponseWriter, r *http.Request)

	GetEducationUsers(w http.ResponseWriter, r *http.Request)
	GetEducationUser(w http.ResponseWriter, r *http.Request)
	PostEducationUser(w http.ResponseWriter, r *http.Request)
	DeleteEducationUser(w http.ResponseWriter, r *http.Request)
	PatchEducationUser(w http.ResponseWriter, r *http.Request)
	DeleteEducationClassMember(w http.ResponseWriter, r *http.Request)

	GetEducationClassTeachers(w http.ResponseWriter, r *http.Request)
	PostEducationClassTeacher(w http.ResponseWriter, r *http.Request)
	DeleteEducationClassTeacher(w http.ResponseWriter, r *http.Request)

	GetDrivesV1(w http.ResponseWriter, r *http.Request)
	GetDrivesV1Beta1(w http.ResponseWriter, r *http.Request)
	GetSingleDrive(w http.ResponseWriter, r *http.Request)
	GetAllDrivesV1(w http.ResponseWriter, r *http.Request)
	GetAllDrivesV1Beta1(w http.ResponseWriter, r *http.Request)
	CreateDrive(w http.ResponseWriter, r *http.Request)
	UpdateDrive(w http.ResponseWriter, r *http.Request)
	DeleteDrive(w http.ResponseWriter, r *http.Request)

	GetSharedByMe(w http.ResponseWriter, r *http.Request)
	ListSharedWithMe(w http.ResponseWriter, r *http.Request)

	GetRootDriveChildren(w http.ResponseWriter, r *http.Request)
	GetDriveItem(w http.ResponseWriter, r *http.Request)
	GetDriveItemChildren(w http.ResponseWriter, r *http.Request)

	CreateUploadSession(w http.ResponseWriter, r *http.Request)

	GetTags(w http.ResponseWriter, r *http.Request)
	AssignTags(w http.ResponseWriter, r *http.Request)
	UnassignTags(w http.ResponseWriter, r *http.Request)
}

Service defines the service handlers.

type UpdateOCMShareClosure

type UpdateOCMShareClosure func(share *ocm.ReceivedShare, request *ocm.UpdateReceivedOCMShareRequest)

UpdateOCMShareClosure is a closure that injects required updates into the update request

type UpdateShareClosure

type UpdateShareClosure func(share *collaboration.ReceivedShare, request *collaboration.UpdateReceivedShareRequest)

UpdateShareClosure is a closure that injects required updates into the update request

Jump to

Keyboard shortcuts

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