Architecture; different "types" of users (not roles)


Hello, I am looking for some advice on how to proceed with a certain project.

I have a few schemas referring to different types of user profiles. These profiles will not be attached to a user until an invitation is sent. Basically, the profile is “activated” and attached to a user that can log in. However the profile can exist separately of the user.

So say there is a Teacher, Student, and Admin profile type. What would be an extensible way to manage keeping the profile and user together with multiple different user types?


I have something similar and I’ve used alanning:roles package to set users as teachers, students or admins. I would suggest that you just add the profiles._id to the user when the account is created. This can be done in

 Accounts.onCreateUser(function(options, user) {
    user.profileId = someProfile._id;


Sorry, this is a really noob question, but how do you populate that object on the subscription? I’ve only ever really done it with Students = new Mongo.collection('collection_name'); Students.find();

I have a publication like this:

Meteor.publish('students', function() {
  var fields = {
    "_id": true,
    "profile": true,
    "roles": true
  return Meteor.users.find({
    roles: "student"
  }, { fields: fields });

If profileId is some arbitrary collection, how do you fetch it?


Put it in a method

  addMyUser: function() {
    if(this.isSimulation) return; // don't run on client

    if (!Roles.userIsInRole(Meteor.user(), 'admin')) {
      var newUserId = var pupilId = Accounts.createUser({
      // etc...