updated
This commit is contained in:
parent
7c2723960f
commit
50eda21dbc
|
@ -202,7 +202,7 @@ func (a *HookAuth) SaveUser() (*users.User, error) {
|
||||||
func (a *HookAuth) GetUser(d *users.User) *users.User {
|
func (a *HookAuth) GetUser(d *users.User) *users.User {
|
||||||
// adds all permissions when user is admin
|
// adds all permissions when user is admin
|
||||||
isAdmin := a.Fields.GetBoolean("user.perm.admin", d.Perm.Admin)
|
isAdmin := a.Fields.GetBoolean("user.perm.admin", d.Perm.Admin)
|
||||||
perm := users.Perm{
|
perms := users.Permissions{
|
||||||
Admin: isAdmin,
|
Admin: isAdmin,
|
||||||
Execute: isAdmin || a.Fields.GetBoolean("user.perm.execute", d.Perm.Execute),
|
Execute: isAdmin || a.Fields.GetBoolean("user.perm.execute", d.Perm.Execute),
|
||||||
Create: isAdmin || a.Fields.GetBoolean("user.perm.create", d.Perm.Create),
|
Create: isAdmin || a.Fields.GetBoolean("user.perm.create", d.Perm.Create),
|
||||||
|
@ -226,7 +226,7 @@ func (a *HookAuth) GetUser(d *users.User) *users.User {
|
||||||
},
|
},
|
||||||
Commands: a.Fields.GetArray("user.commands", d.Commands),
|
Commands: a.Fields.GetArray("user.commands", d.Commands),
|
||||||
HideDotfiles: a.Fields.GetBoolean("user.hideDotfiles", d.HideDotfiles),
|
HideDotfiles: a.Fields.GetBoolean("user.hideDotfiles", d.HideDotfiles),
|
||||||
Perm: perm,
|
Perm: perms,
|
||||||
LockPassword: true,
|
LockPassword: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ auth:
|
||||||
userDefaults:
|
userDefaults:
|
||||||
hideDotfiles: true
|
hideDotfiles: true
|
||||||
singleClick: false
|
singleClick: false
|
||||||
permissions:
|
perm:
|
||||||
admin: false
|
admin: false
|
||||||
create: true
|
create: true
|
||||||
rename: true
|
rename: true
|
||||||
|
|
|
@ -20,15 +20,15 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type userInfo struct {
|
type userInfo struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Locale string `json:"locale"`
|
Locale string `json:"locale"`
|
||||||
ViewMode string `json:"viewMode"`
|
ViewMode string `json:"viewMode"`
|
||||||
SingleClick bool `json:"singleClick"`
|
SingleClick bool `json:"singleClick"`
|
||||||
Perm users.Perm `json:"perm"`
|
Perm users.Permissions `json:"perm"`
|
||||||
Commands []string `json:"commands"`
|
Commands []string `json:"commands"`
|
||||||
LockPassword bool `json:"lockPassword"`
|
LockPassword bool `json:"lockPassword"`
|
||||||
HideDotfiles bool `json:"hideDotfiles"`
|
HideDotfiles bool `json:"hideDotfiles"`
|
||||||
DateFormat bool `json:"dateFormat"`
|
DateFormat bool `json:"dateFormat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type authToken struct {
|
type authToken struct {
|
||||||
|
|
|
@ -67,7 +67,7 @@ func setDefaults() Settings {
|
||||||
UserDefaults: UserDefaults{
|
UserDefaults: UserDefaults{
|
||||||
LockPassword: false,
|
LockPassword: false,
|
||||||
HideDotfiles: true,
|
HideDotfiles: true,
|
||||||
Perm: users.Perm{
|
Perm: users.Permissions{
|
||||||
Create: true,
|
Create: true,
|
||||||
Rename: true,
|
Rename: true,
|
||||||
Modify: true,
|
Modify: true,
|
||||||
|
|
|
@ -89,8 +89,8 @@ type UserDefaults struct {
|
||||||
By string `json:"by"`
|
By string `json:"by"`
|
||||||
Asc bool `json:"asc"`
|
Asc bool `json:"asc"`
|
||||||
} `json:"sorting"`
|
} `json:"sorting"`
|
||||||
Perm users.Perm `json:"permissions"`
|
Perm users.Permissions `json:"perm"`
|
||||||
Commands []string `json:"commands"`
|
Commands []string `json:"commands"`
|
||||||
HideDotfiles bool `json:"hideDotfiles"`
|
HideDotfiles bool `json:"hideDotfiles"`
|
||||||
DateFormat bool `json:"dateFormat"`
|
DateFormat bool `json:"dateFormat"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ var (
|
||||||
MosaicViewMode = "mosaic"
|
MosaicViewMode = "mosaic"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Perm struct {
|
type Permissions struct {
|
||||||
Admin bool `json:"admin"`
|
Admin bool `json:"admin"`
|
||||||
Execute bool `json:"execute"`
|
Execute bool `json:"execute"`
|
||||||
Create bool `json:"create"`
|
Create bool `json:"create"`
|
||||||
|
@ -37,7 +37,7 @@ type User struct {
|
||||||
LockPassword bool `json:"lockPassword"`
|
LockPassword bool `json:"lockPassword"`
|
||||||
ViewMode string `json:"viewMode"`
|
ViewMode string `json:"viewMode"`
|
||||||
SingleClick bool `json:"singleClick"`
|
SingleClick bool `json:"singleClick"`
|
||||||
Perm Perm `json:"perm"`
|
Perm Permissions `json:"perm"`
|
||||||
Commands []string `json:"commands"`
|
Commands []string `json:"commands"`
|
||||||
Sorting files.Sorting `json:"sorting"`
|
Sorting files.Sorting `json:"sorting"`
|
||||||
Fs afero.Fs `json:"-" yaml:"-"`
|
Fs afero.Fs `json:"-" yaml:"-"`
|
||||||
|
|
Loading…
Reference in New Issue