Fix frontend render for users with api role

This commit is contained in:
Christoph Kluge 2023-07-17 12:19:49 +02:00
parent 56f66aa706
commit 55943cacbf

View File

@ -166,10 +166,10 @@ func GetValidRoles(user *User) ([]string, error) {
return vals, fmt.Errorf("%s: only admins are allowed to fetch a list of roles", user.Username) return vals, fmt.Errorf("%s: only admins are allowed to fetch a list of roles", user.Username)
} }
// Called by routerConfig web.page setup in backend: Only requires known user and/or not API user // Called by routerConfig web.page setup in backend: Only requires known user
func GetValidRolesMap(user *User) (map[string]Role, error) { func GetValidRolesMap(user *User) (map[string]Role, error) {
named := make(map[string]Role) named := make(map[string]Role)
if user.HasNotRoles([]Role{RoleApi, RoleAnonymous}) { if user.HasNotRoles([]Role{RoleAnonymous}) {
for i := RoleApi; i < RoleError; i++ { for i := RoleApi; i < RoleError; i++ {
named[GetRoleString(i)] = i named[GetRoleString(i)] = i
} }