mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Merge pull request #182 from ClusterCockpit/179_fix_frontend_apiusers
Fix frontend render for users with api role
This commit is contained in:
commit
c0ab5de2f1
@ -163,10 +163,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