MCPcopy Create free account
hub / github.com/kataras/iris / AllowAdmin

Function AllowAdmin

_examples/auth/jwt/tutorial/api/auth.go:56–63  ·  view source on GitHub ↗

AllowAdmin allows only authorized clients with "admin" access role. Should be registered after Verify.

(ctx iris.Context)

Source from the content-addressed store, hash-verified

54// AllowAdmin allows only authorized clients with "admin" access role.
55// Should be registered after Verify.
56func AllowAdmin(ctx iris.Context) {
57 if !IsAdmin(ctx) {
58 ctx.StopWithText(iris.StatusForbidden, "admin access required")
59 return
60 }
61
62 ctx.Next()
63}
64
65// SignIn accepts the user form data and returns a token to authorize a client.
66func SignIn(repo repository.UserRepository) iris.Handler {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.85
StopWithTextMethod · 0.80
NextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…