dropbox

package
v0.0.0-...-cda7898 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ParamFileID is the name of the file id param in URL.
	ParamFileID = "id"

	// ParamUserID is the name of the user id param in URL.
	ParamUserID = "id"

	// ParamApproverID is the name of the approver id param in the URL.
	ParamApproverID = "approverID"

	// QueryGetAll is the name of the query if get for all users
	QueryGetAll = "all"

	// HeaderFileID is the context key used to get fileId.
	HeaderFileID = "fileID"

	// HeaderDestionation is the context key used to get and set the external destination.
	HeaderDestionation = "destination"

	// ConfigTomcalDest is the name of the environment variable containing the tomcal dest name.
	ConfigTomcalDest = "tomcal_dest_value"

	// ConfigCtsDest is the name of the environment variable containing the cts dest name.
	ConfigCtsDest = "cts_dest_value"

	// ParamPageNum is a constant for the requested page num in the pagination.
	ParamPageNum = "pageNum"

	// ParamPageSize is a constant for the requested page size in the pagination.
	ParamPageSize = "pageSize"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

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

Router is a structure that handles permission requests.

func NewRouter

func NewRouter(
	dropboxConn *grpcPoolTypes.ConnPool,
	permissionConn *grpcPoolTypes.ConnPool,
	fileConn *grpcPoolTypes.ConnPool,
	oAuthMiddleware *oauth.Middleware,
	logger *logrus.Logger,
) *Router

NewRouter creates a new Router, and initializes clients of the quota Service with the given connection. If logger is non-nil then it will be set as-is, otherwise logger would default to logrus.New().

func (*Router) CanApproveToUser

func (r *Router) CanApproveToUser(c *gin.Context)

CanApproveToUser is the request handler for GET /users/:userId/canApproveToUser/:approverID Requires a destination header

func (*Router) CreateExternalShareRequest

func (r *Router) CreateExternalShareRequest(c *gin.Context)

CreateExternalShareRequest creates permits for a given file and users File id is extracted from url params, role is extracted from request body.

func (*Router) GetApproverInfo

func (r *Router) GetApproverInfo(c *gin.Context)

GetApproverInfo is the request handler for GET /users/:id/approverInfo

func (*Router) GetTransfersInfo

func (r *Router) GetTransfersInfo(c *gin.Context)

GetTransfersInfo is a route function for retrieving transfersInfo of a file File id is extracted from url params

func (*Router) HandleUserFilePermission

func (r *Router) HandleUserFilePermission(
	c *gin.Context,
	fileID string,
	role ppb.Role) (string, *ppb.PermissionObject)

HandleUserFilePermission gets the id of the requested file, and the required role. Returns the user role as a string, and the permission if the user is permitted to operate on the file, and `"", nil` if not.

func (*Router) Setup

func (r *Router) Setup(rg *gin.RouterGroup)

Setup sets up r and initializes its routes under rg.

type User

type User struct {
	ID       string `json:"id,omitempty"`
	FullName string `json:"full_name,omitempty"`
}

User struct

Jump to

Keyboard shortcuts

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