From eb6335f0ca246ba1b5e10166d93b4fb7b6c06a7e 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. Former-commit-id: 92399ec4ca3a988389be5deb74eb1ac0903fd462 [formerly d29499b1b6ee772bd00e24cca01227b0e6f16393] [formerly 06d3f2067388a007195cf3b015cea699332b3151 [formerly 6fffd722e61fa16bdcb4879c50f3213543f022ac]] Former-commit-id: be20a29f697bfdf99596064ae4c838a9839ce256 [formerly d0de7b61e4dc553e5d49b4c4d43e56056c333cb6] Former-commit-id: a23c582e735a544fb799e1e8700f4c794ba01707 --- 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.