Lots of UI and admin changes, need to clean up the three audit log tables and a few other niggles.

This commit is contained in:
2025-04-01 00:05:48 +01:00
parent 7eefb9ced0
commit aaf90b55da
11 changed files with 309 additions and 52 deletions

View File

@@ -49,20 +49,24 @@ func TemplateContext(w http.ResponseWriter, r *http.Request) map[string]interfac
}
var currentUser *models.User
var isAdmin bool
switch v := session.Values["user_id"].(type) {
case int:
currentUser = models.GetUserByID(v)
case int64:
currentUser = models.GetUserByID(int(v))
default:
currentUser = nil
}
if currentUser != nil {
isAdmin = currentUser.IsAdmin
}
return map[string]interface{}{
"CSRFField": csrf.TemplateField(r),
"Flash": flash,
"User": currentUser,
"IsAdmin": isAdmin,
}
}