diff --git a/src/webapi/router/router_builtin.go b/src/webapi/router/router_builtin.go index 7b435acf..7b97da4f 100644 --- a/src/webapi/router/router_builtin.go +++ b/src/webapi/router/router_builtin.go @@ -20,7 +20,7 @@ func alertRuleBuiltinList(c *gin.Context) { fp = path.Join(runner.Cwd, "etc", "alerts") } - files, err := file.DirsUnder(fp) + files, err := file.FilesUnder(fp) ginx.Dangerous(err) names := make([]string, 0, len(files)) @@ -93,7 +93,7 @@ func dashboardBuiltinList(c *gin.Context) { fp = path.Join(runner.Cwd, "etc", "dashboards") } - files, err := file.DirsUnder(fp) + files, err := file.FilesUnder(fp) ginx.Dangerous(err) names := make([]string, 0, len(files)) diff --git a/src/webapi/router/router_mw.go b/src/webapi/router/router_mw.go index 1722384d..1029c63e 100644 --- a/src/webapi/router/router_mw.go +++ b/src/webapi/router/router_mw.go @@ -67,6 +67,7 @@ func user() gin.HandlerFunc { } c.Set("user", user) + c.Set("isadmin", user.IsAdmin()) c.Next() } }