// AdminOnly allows access to admins
AdminOnly allows access to admins
// AdminOnly allows access to admins
func (a *Authenticator) AdminOnly(next http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		user, err := rest.GetUserInfo(r)
		if err != nil {
			http.Error(w, "Unauthorized", http.StatusUnauthorized)
			return
		}
		if !user.Admin {
			http.Error(w, "Access denied", http.StatusForbidden)
			return
		}
		next.ServeHTTP(w, r)
	}
	return http.HandlerFunc(fn)
}
func ( a * Authenticator ) AdminOnly ( next http . Handler ) http . Handler { fn := func ( w http . ResponseWriter , r * http . Request ) { user , err := rest . GetUserInfo ( r ) if err != nil { http . Error ( w , " " , http . StatusUnauthorized ) return } if ! user . Admin { http . Error ( w , " " , http . StatusForbidden ) return } next . ServeHTTP ( w , r ) } return http . HandlerFunc ( fn ) }
AdminOnly allows access to admins
AdminOnly allows access to admins