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
This commit is contained in:
parent
f4f1fc4213
commit
eb6335f0ca
|
@ -54,6 +54,9 @@ type User struct {
|
||||||
// emptied during JSON marshall.
|
// emptied during JSON marshall.
|
||||||
Password string `json:"password"`
|
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 is the virtual file system the user has access.
|
||||||
FileSystem webdav.Dir `json:"filesystem"`
|
FileSystem webdav.Dir `json:"filesystem"`
|
||||||
|
|
||||||
|
@ -103,6 +106,7 @@ var DefaultUser = User{
|
||||||
Commands: []string{},
|
Commands: []string{},
|
||||||
Rules: []*Rule{},
|
Rules: []*Rule{},
|
||||||
CSS: "",
|
CSS: "",
|
||||||
|
Admin: true,
|
||||||
FileSystem: webdav.Dir("."),
|
FileSystem: webdav.Dir("."),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +164,8 @@ func New(database string, base User) (*FileManager, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The first user must be an administrator.
|
||||||
|
base.Admin = true
|
||||||
base.Password = pw
|
base.Password = pw
|
||||||
|
|
||||||
// Saves the user to the database.
|
// Saves the user to the database.
|
||||||
|
|
Loading…
Reference in New Issue