config

package
v0.0.0-...-5fd8514 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandFunc

type CommandFunc func(r *http.Request, c *Config, u *User) error

CommandFunc ...

func CommandRunner

func CommandRunner(c *caddy.Controller) (CommandFunc, error)

CommandRunner ...

type Config

type Config struct {
	*User
	PrefixURL   string
	BaseURL     string
	WebDavURL   string
	HugoEnabled bool // Enables the Hugo plugin for File Manager
	Users       map[string]*User
	BeforeSave  CommandFunc
	AfterSave   CommandFunc
}

Config is a configuration for browsing in a particular path.

func Parse

func Parse(c *caddy.Controller) ([]Config, error)

Parse parses the configuration set by the user so it can be used by the middleware

func (Config) AbsoluteURL

func (c Config) AbsoluteURL() string

AbsoluteURL ...

func (Config) AbsoluteWebdavURL

func (c Config) AbsoluteWebdavURL() string

AbsoluteWebdavURL ...

type Rule

type Rule struct {
	Regex  bool
	Allow  bool
	Path   string
	Regexp *regexp.Regexp
}

Rule is a dissalow/allow rule

type User

type User struct {
	Scope         string            `json:"-"` // Path the user have access
	FileSystem    webdav.FileSystem `json:"-"` // The virtual file system the user have access
	Handler       *webdav.Handler   `json:"-"` // The WebDav HTTP Handler
	StyleSheet    string            `json:"-"` // Costum stylesheet
	AllowNew      bool              // Can create files and folders
	AllowEdit     bool              // Can edit/rename files
	AllowCommands bool              // Can execute commands
	Commands      []string          // Available Commands
	Rules         []*Rule           `json:"-"` // Access rules
}

User contains the configuration for each user

func (User) Allowed

func (u User) Allowed(url string) bool

Allowed checks if the user has permission to access a directory/file

Jump to

Keyboard shortcuts

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