mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Fix frontend render for users with api role
This commit is contained in:
parent
56f66aa706
commit
55943cacbf
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user