/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2024 */ package rest import ( "net/http" "yats/internal/config" "yats/internal/db" "github.com/gin-gonic/gin" ) // ShowPermissions godoc // @Param X-SSL-Client-CN header string true "clientCN" // @Summary Show available Metrics and Event for current user // @Schemes // @Description Show available Metrics and Event for current user // @Tags Permissions // @Produce json // @Success 200 {object} []model.AvailableMetric // @Router /perms [get] func ShowPermissions(cfg config.Configuration) gin.HandlerFunc { return func(c *gin.Context) { clientCN := GetClientCN(c, cfg) availableMetrics := db.GetAvailableMetrics(db.Session, clientCN) externalSources := db.GetExternalSources(db.Session, clientCN) JsonPrint(cfg, c, http.StatusAccepted, gin.H{"metrics": availableMetrics, "externalSources": externalSources}) } }