Documentation ¶
Index ¶
- func AccountApi2Backend(apiAccount *api.Account, bAccount *Account) error
- func AccountBackend2Api(bAccount *Account, apiAccount *api.Account) error
- type Account
- type AccountSpecificAuth
- type Authentication
- func (auth *Authentication) GetAuthenticatedUser(w http.ResponseWriter, r *http.Request) (user *Account, err error)
- func (auth *Authentication) GetAvailableAuthentications() []string
- func (auth *Authentication) GetInfo(w http.ResponseWriter, r *http.Request)
- func (auth *Authentication) ListUsers(w http.ResponseWriter, r *http.Request)
- func (auth *Authentication) LogOut(w http.ResponseWriter, r *http.Request)
- type Command
- type CommandContext
- type CommandHandler
- type Configuration
- type DatabaseInterface
- type DownloadLink
- type EnumCommandHandlerStatus
- type HttpError
- type Session
- type ShareLink
- type SubAuthentication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { Login string `json:"login" bson:"login" sql:"type:varchar;"` Email string `json:"email" bson:"email" sql:"type:varchar;"` Id string `json:"id" bson:"id" sql:"type:varchar;"` //This id should be unique depending on the DbType IsAdmin bool `json:"is_admin" bson:"is_admin" sql:"type:boolean;"` //Can only be changed by the admin //Add some other infos here for all the specific stuffs Auths map[string]AccountSpecificAuth `sql:"-"` }
type AccountSpecificAuth ¶
type Authentication ¶
type Authentication struct { Auths []SubAuthentication Config *Configuration }
func (*Authentication) GetAuthenticatedUser ¶
func (auth *Authentication) GetAuthenticatedUser(w http.ResponseWriter, r *http.Request) (user *Account, err error)
func (*Authentication) GetAvailableAuthentications ¶
func (auth *Authentication) GetAvailableAuthentications() []string
func (*Authentication) GetInfo ¶
func (auth *Authentication) GetInfo(w http.ResponseWriter, r *http.Request)
func (*Authentication) ListUsers ¶
func (auth *Authentication) ListUsers(w http.ResponseWriter, r *http.Request)
func (*Authentication) LogOut ¶
func (auth *Authentication) LogOut(w http.ResponseWriter, r *http.Request)
type Command ¶
type CommandContext ¶
type CommandHandler ¶
type CommandHandler interface { Handle(context *CommandContext, resp chan<- EnumCommandHandlerStatus) *HttpError GetUploadPath(context *CommandContext) (path *string, resultFileSize int64, hErr *HttpError) }
type Configuration ¶
type Configuration struct { RootPrefix string PrivateKey string StaticPath string HtmlPrefix string WebPort string AllowRootWrite bool Public bool Db DatabaseInterface Auth *Authentication UploadChunkSize int64 Debug bool }
Configuration Structure
type DatabaseInterface ¶
type DatabaseInterface interface { Name() string ListCommands(user *string, offset int, limit int, search_parameters *api.CommandsSearchParameters) ([]*Command, int, error) //set limit to -1 for retrieving all the elements, search_parameters will be used to filter response SaveCommand(command *Command) (err error) GetCommand(ref string) (command *Command, err error) DeleteCommand(ref *string) (err error) AddDownloadLink(link *DownloadLink) (err error) GetDownloadLink(path string) (link *DownloadLink, err error) //We need to implement some authentication structures to AddAccount(account *Account) (err error) GetAccount(authType string, ref string) (account *Account, id string, err error) // if authType = "" we just want to match for the id, do not care about the authType UpdateAccount(id string, account *Account) (err error) GetUserAccount(id string) (account *Account, err error) ListAccounts(searchDict map[string]string) (accounts []*Account, err error) GetAccess(user *string, path string) (api.AccessType, error) //If user is nil then it's public access SetAccess(user *string, path string, access api.AccessType) error // This can only be called by a admin... ClearAccesses() error //Should only be called when configuration is done by files StoreSession(session *Session) (err error) GetSession(ref string) (session *Session, err error) RemoveSession(ref string) (err error) //ShareLink }
type DownloadLink ¶
type DownloadLink struct { Link string `json:"link" bson:"link" sql:"type:varchar;"` Path string `json:"path" bson:"path" sql:"type:varchar;"` RealPath *string `json:"real_path,omitempty" bson:"real_path,omitempty" sql:"type:varchar;"` //Will only be used when storing in the DB }
func (*DownloadLink) String ¶
func (d *DownloadLink) String() string
type EnumCommandHandlerStatus ¶
type EnumCommandHandlerStatus int
const ( EnumCommandHandlerError EnumCommandHandlerStatus = 0 EnumCommandHandlerDone EnumCommandHandlerStatus = 1 EnumCommandHandlerPostponed EnumCommandHandlerStatus = 2 )
type SubAuthentication ¶
Click to show internal directories.
Click to hide internal directories.