1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/**
* Yats - yats
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Paolo Lulli <kevwe.com>
* @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})
}
}
|