(fn handleFunc)
| 111 | } |
| 112 | |
| 113 | func 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 | |
| 123 | func loginHandler(tokenExpireTime time.Duration) handleFunc { |
| 124 | return func(w http.ResponseWriter, r *http.Request, d *data) (int, error) { |
no test coverage detected