MCPcopy
hub / github.com/filebrowser/filebrowser / withAdmin

Function withAdmin

http/auth.go:113–121  ·  view source on GitHub ↗
(fn handleFunc)

Source from the content-addressed store, hash-verified

111}
112
113func withAdmin(fn handleFunc) handleFunc {
114 return withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
115 if !d.user.Perm.Admin {
116 return http.StatusForbidden, nil
117 }
118
119 return fn(w, r, d)
120 })
121}
122
123func loginHandler(tokenExpireTime time.Duration) handleFunc {
124 return func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {

Callers 2

users.goFile · 0.85
settings.goFile · 0.85

Calls 1

withUserFunction · 0.85

Tested by

no test coverage detected