Refactor: change number of return parameters from page functions, include error handling in wrapper

This commit is contained in:
2026-02-10 16:32:20 -07:00
parent e163224a62
commit 080f78a414
15 changed files with 497 additions and 589 deletions
+3 -8
View File
@@ -11,9 +11,6 @@
package main
import (
"errors"
"net/http"
"git.erbosoft.com/amy/amsterdam/database"
"git.erbosoft.com/amy/amsterdam/ui"
)
@@ -24,17 +21,15 @@ import (
* Returns:
* Command string dictating what to be rendered.
* Data as a parameter for the command string.
* Standard Go error status.
*/
func SysAdminMenu(ctxt ui.AmContext) (string, any, error) {
func SysAdminMenu(ctxt ui.AmContext) (string, any) {
u := ctxt.CurrentUser()
if !database.AmTestPermission("Global.SysAdminAccess", u.BaseLevel) {
ctxt.SetRC(http.StatusForbidden)
return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page"))
return "error", ENOACCESS
}
menu := ui.AmMenu("sysadmin")
ctxt.VarMap().Set("menu", menu)
ctxt.VarMap().Set("defs", make(map[string]bool))
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title)
return "framed_template", "menu.jet", nil
return "framed", "menu.jet"
}