2019-01-06 06:44:33 +08:00
|
|
|
package settings
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/filebrowser/filebrowser/v2/files"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/users"
|
|
|
|
)
|
|
|
|
|
|
|
|
// UserDefaults is a type that holds the default values
|
|
|
|
// for some fields on User.
|
|
|
|
type UserDefaults struct {
|
2020-11-20 18:51:28 +08:00
|
|
|
Scope string `json:"scope"`
|
|
|
|
Locale string `json:"locale"`
|
|
|
|
ViewMode users.ViewMode `json:"viewMode"`
|
2020-11-24 02:06:37 +08:00
|
|
|
SingleClick bool `json:"singleClick"`
|
2020-11-20 18:51:28 +08:00
|
|
|
Sorting files.Sorting `json:"sorting"`
|
|
|
|
Perm users.Permissions `json:"perm"`
|
|
|
|
Commands []string `json:"commands"`
|
|
|
|
HideDotfiles bool `json:"hideDotfiles"`
|
2021-09-11 20:12:51 +08:00
|
|
|
DateFormat bool `json:"dateFormat"`
|
2019-01-06 06:44:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Apply applies the default options to a user.
|
|
|
|
func (d *UserDefaults) Apply(u *users.User) {
|
|
|
|
u.Scope = d.Scope
|
|
|
|
u.Locale = d.Locale
|
|
|
|
u.ViewMode = d.ViewMode
|
2020-11-24 02:06:37 +08:00
|
|
|
u.SingleClick = d.SingleClick
|
2019-01-06 06:44:33 +08:00
|
|
|
u.Perm = d.Perm
|
|
|
|
u.Sorting = d.Sorting
|
|
|
|
u.Commands = d.Commands
|
2020-11-20 18:51:28 +08:00
|
|
|
u.HideDotfiles = d.HideDotfiles
|
2021-09-11 20:12:51 +08:00
|
|
|
u.DateFormat = d.DateFormat
|
2019-01-06 06:44:33 +08:00
|
|
|
}
|