config

package
v0.0.0-...-7057679 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*User
	BaseURL     string
	AbsoluteURL string
	AddrPath    string
	Token       string // Anti CSRF token
	HugoEnabled bool   // Enables the Hugo plugin for File Manager
	Users       map[string]*User
	WebDavURL   string
	CurrentUser *User
}

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

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
	FrontMatter   string            `json:"-"` // Default frontmatter to save files in
	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