URL based context (company or team)

Hello there,

We @ Pulpo are trying to build a company/team based application. That means, we want a user to have several different teams and/or companies and be able to select in which team wants to work.

For example: domain.com/{context}/… => domain.com/pulpo-team/… or domain.com/meteor-group/

How is it possible to be implemented? I want to have like a userId variable on the server side and client side that tells me which context I am in.


Just pass it to subscriptions as a variable. Eg, your url is /groups/:team/posts/:_id, then you pass it to the publication like this:

Meteor.publish('team_post', function (team, postId) {
  check(team, postId);
  if (isInGroup(this.userId, team)) {
    return Posts.find({
      _id: postId,
      teamId: team
  } else {

Sounds good, but for every single publish/subscribe I need to send it. Is there a easy and global way to do this? Like, userId does.