filebrowser/settings/defaults.go

30 lines
841 B
Go
Raw Normal View History

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 10:51:28 +00:00
Scope string `json:"scope"`
Locale string `json:"locale"`
ViewMode users.ViewMode `json:"viewMode"`
Sorting files.Sorting `json:"sorting"`
Perm users.Permissions `json:"perm"`
Commands []string `json:"commands"`
HideDotfiles bool `json:"hideDotfiles"`
}
// 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
u.Perm = d.Perm
u.Sorting = d.Sorting
u.Commands = d.Commands
2020-11-20 10:51:28 +00:00
u.HideDotfiles = d.HideDotfiles
}