mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 13:23:07 +01:00
fix: resets session for existing users who do not have roles defined (#4141)
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user