1
0
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:
Amir Raminfar
2025-09-23 11:05:32 -07:00
committed by GitHub
parent ab86a6c59e
commit 5aea48f3ca
2 changed files with 6 additions and 5 deletions

View File

@@ -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))

View File

@@ -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)
}