Add new role support. This enables designated users to see all jobs.

This commit is contained in:
Michael Schwarz
2022-08-23 13:33:25 +02:00
parent a0dafbac99
commit 84bac7e520
9 changed files with 21 additions and 12 deletions

View File

@@ -269,15 +269,17 @@ func SetupRoutes(router *mux.Router) {
title = strings.Replace(route.Title, "<ID>", id.(string), 1)
}
username, isAdmin := "", true
username, isAdmin, isSupporter := "", true, true
if user := auth.GetUser(r.Context()); user != nil {
username = user.Username
isAdmin = user.HasRole(auth.RoleAdmin)
isSupporter = user.HasRole(auth.RoleSupport)
}
page := web.Page{
Title: title,
User: web.User{Username: username, IsAdmin: isAdmin},
User: web.User{Username: username, IsAdmin: isAdmin, IsSupporter: isSupporter},
Config: conf,
Infos: infos,
}