Add ADMIN field to user.

Former-commit-id: 92399ec4ca3a988389be5deb74eb1ac0903fd462 [formerly d29499b1b6ee772bd00e24cca01227b0e6f16393] [formerly 06d3f2067388a007195cf3b015cea699332b3151 [formerly 6fffd722e6]]
Former-commit-id: be20a29f697bfdf99596064ae4c838a9839ce256 [formerly d0de7b61e4dc553e5d49b4c4d43e56056c333cb6]
Former-commit-id: a23c582e735a544fb799e1e8700f4c794ba01707
This commit is contained in:
Henrique Dias 2017-07-06 09:33:36 +01:00
parent f4f1fc4213
commit eb6335f0ca
1 changed files with 6 additions and 0 deletions

View File

@ -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.