Documentation ¶
Index ¶
- Constants
- type Router
- func (r *Router) CanApproveToUser(c *gin.Context)
- func (r *Router) CreateExternalShareRequest(c *gin.Context)
- func (r *Router) GetApproverInfo(c *gin.Context)
- func (r *Router) GetTransfersInfo(c *gin.Context)
- func (r *Router) HandleUserFilePermission(c *gin.Context, fileID string, role ppb.Role) (string, *ppb.PermissionObject)
- func (r *Router) Setup(rg *gin.RouterGroup)
- type User
Constants ¶
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 ¶
CanApproveToUser is the request handler for GET /users/:userId/canApproveToUser/:approverID Requires a destination header
func (*Router) CreateExternalShareRequest ¶
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 ¶
GetApproverInfo is the request handler for GET /users/:id/approverInfo
func (*Router) GetTransfersInfo ¶
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.