MCPcopy
hub / github.com/ccfos/nightingale / perm

Method perm

center/router/router_mw.go:280–293  ·  view source on GitHub ↗
(operation string)

Source from the content-addressed store, hash-verified

278}
279
280func (rt *Router) perm(operation string) gin.HandlerFunc {
281 return func(c *gin.Context) {
282 me := c.MustGet("user").(*models.User)
283
284 can, err := me.CheckPerm(rt.Ctx, operation)
285 ginx.Dangerous(err)
286
287 if !can {
288 ginx.Bomb(http.StatusForbidden, "forbidden")
289 }
290
291 c.Next()
292 }
293}
294
295func (rt *Router) admin() gin.HandlerFunc {
296 return func(c *gin.Context) {

Callers 2

ConfigMethod · 0.95
PermMethod · 0.95

Calls 1

CheckPermMethod · 0.80

Tested by

no test coverage detected