func CurrentUser(w http.ResponseWriter, r *http.Request) {
	params := mux.Vars(r)
	site := params["site"]
	ctx := r.Context()
	userID := util.CurrentUserID(ctx)
	user, _ := query.GetUser(userID)
	if user != nil {
		hasAccess := permission.HasAccessTo(ctx, userID, "site/access", map[string]interface{}{"site": site})
		if hasAccess {
			roles, _ := query.FetchUserRoles(ctx, userID)
			roleResult := []string{}
			for _, role := range roles {
				roleResult = append(roleResult, role.Value("identifier").(string))
			}
			result, _ := contenttype.ContentToMap(user)
			result["roles"] = roleResult
			WriteResponse(result, w)
		} else {
			HandleError(errors.New("Doesn't have access"), w, 403)
		}
	} else {
		HandleError(errors.New("No user in context"), w)
	}
}
Get current user
package rest
import (
	"encoding/json"
	"errors"
	"fmt"
	"net/http"
	"strconv"
	"strings"
	"time"
	"github.com/digimakergo/digimaker/core/contenttype"
	"github.com/digimakergo/digimaker/core/db"
	"github.com/digimakergo/digimaker/core/handler"
	"github.com/digimakergo/digimaker/core/log"
	"github.com/digimakergo/digimaker/core/permission"
	"github.com/digimakergo/digimaker/core/query"
	"github.com/digimakergo/digimaker/core/util"
	"github.com/gorilla/mux"
)