diff --git a/internal/auth/roles.go b/internal/auth/roles.go index 059b35bd..6ca7c37a 100644 --- a/internal/auth/roles.go +++ b/internal/auth/roles.go @@ -17,12 +17,8 @@ const ( const All = Shell | Actions | Download -// ParseRole parses a comma-separated string of roles and returns the corresponding Role. Default is All for empty input. +// ParseRole parses a comma-separated string of roles and returns the corresponding Role. func ParseRole(commaValues string) Role { - if strings.TrimSpace(commaValues) == "" { - return All - } - var roles Role for r := range strings.SplitSeq(commaValues, ",") { role := strings.TrimSpace(strings.ToLower(r)) diff --git a/internal/auth/users.go b/internal/auth/users.go index 96e7df5d..371d6199 100644 --- a/internal/auth/users.go +++ b/internal/auth/users.go @@ -9,6 +9,7 @@ import ( "net/http" "net/url" "os" + "strings" "time" "github.com/amir20/dozzle/internal/container" @@ -113,6 +114,10 @@ func decodeUsersFromFile(path string) (UserDatabase, error) { user.Name = username } + if strings.TrimSpace(user.RolesConfigured) == "" { + user.RolesConfigured = "all" + } + user.Roles = ParseRole(user.RolesConfigured) }