From 6fffd722e61fa16bdcb4879c50f3213543f022ac Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 6 Jul 2017 09:33:36 +0100 Subject: [PATCH] Add ADMIN field to user. --- filemanager.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/filemanager.go b/filemanager.go index 6ac53c03..49f56ee9 100644 --- a/filemanager.go +++ b/filemanager.go @@ -54,6 +54,9 @@ type User struct { // emptied during JSON marshall. Password string `json:"password"` + // Tells if this user is an admin. + Admin bool `json:"admin"` + // FileSystem is the virtual file system the user has access. FileSystem webdav.Dir `json:"filesystem"` @@ -103,6 +106,7 @@ var DefaultUser = User{ Commands: []string{}, Rules: []*Rule{}, CSS: "", + Admin: true, FileSystem: webdav.Dir("."), } @@ -160,6 +164,8 @@ func New(database string, base User) (*FileManager, error) { return nil, err } + // The first user must be an administrator. + base.Admin = true base.Password = pw // Saves the user to the database.