fix: use server options from DB too (#616)
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> Former-commit-id: bb60ec81f56f5d761ef76b2c1e26bbe83210f434 [formerly b28f83c65e0934e138a1710549f52e0f66a158e0] [formerly 7138a3215ceb144afa0ea45be2315f30b052109f [formerly 72069207c6bb0664c7b270096f6916cce76ebeb1]] Former-commit-id: 0fb7ae6353f786edd93a9166141bfa446dd3dbf9 [formerly 5cb07e8c96a7cfca1aec5843123e1abc4ca8578a] Former-commit-id: 914c0348516f072a9ccce4e105327feaaddb4cc0
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/filebrowser/filebrowser/v2/storage"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -28,7 +29,7 @@ rules.`,
|
||||
}
|
||||
|
||||
func runRules(st *storage.Storage, cmd *cobra.Command, users func(*users.User), global func(*settings.Settings)) {
|
||||
id := getUserIdentifier(cmd)
|
||||
id := getUserIdentifier(cmd.Flags())
|
||||
if id != nil {
|
||||
user, err := st.Users.Get("", id)
|
||||
checkErr(err)
|
||||
@@ -51,9 +52,9 @@ func runRules(st *storage.Storage, cmd *cobra.Command, users func(*users.User),
|
||||
printRules(settings.Rules, id)
|
||||
}
|
||||
|
||||
func getUserIdentifier(cmd *cobra.Command) interface{} {
|
||||
id := mustGetUint(cmd, "id")
|
||||
username := mustGetString(cmd, "username")
|
||||
func getUserIdentifier(flags *pflag.FlagSet) interface{} {
|
||||
id := mustGetUint(flags, "id")
|
||||
username := mustGetString(flags, "username")
|
||||
|
||||
if id != 0 {
|
||||
return id
|
||||
|
||||
Reference in New Issue
Block a user