From 95262b4289203a1674a033be07800d60a573fcc3 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 21 Aug 2016 18:44:22 +0100 Subject: [PATCH] Update rules #19 #21 #23 #24 --- config/config.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/config/config.go b/config/config.go index ed101d15..cc312deb 100644 --- a/config/config.go +++ b/config/config.go @@ -25,21 +25,23 @@ type Config struct { // UserConfig contains the configuration for each user type UserConfig struct { - PathScope string - Root http.FileSystem - StyleSheet string // Costum stylesheet - FrontMatter string // Default frontmatter to save files in - AllowNew bool // Can create files and folders - AllowEdit bool // Can edit/rename files + PathScope string + Root http.FileSystem + StyleSheet string // Costum stylesheet + FrontMatter string // 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 // Access rules +} - Allow []string // Allowed browse directories/files - AllowRegex []*regexp.Regexp // Regex of the previous - Block []string // Blocked browse directories/files - BlockRegex []*regexp.Regexp // Regex of the previous - - AllowCommands bool // Can execute commands - AllowedCommands []string // Allowed commands - BlockedCommands []string // Blocked Commands +// Rule is a dissalow/allow rule +type Rule struct { + Regex bool + Allow bool + Path string + Rexexp *regexp.Regexp } // Parse parses the configuration set by the user so it can