code: function checkAuthenticated(req, res, next) {
  	if (!req.user) {
  		api.writeError(401, res, "Not authenticated");
  	} else {
  		req.user.workspaceDir = workspaceDir + (req.user.workspace ? "/" + req.user.workspace : "");
  		req.user.checkRights = checkRights;
  		next();
  	}
  }
docs: Check if the request is authenticated
  @param {XmlHttpRequest} req The original request
  @param {XmlHttpResponse} res The orginal response
  @param {fn} next The function to advance the Express queue