Restrict formatting of posts via User Type


#1

Hi,

I need to add some sort of user security/roles on my app, perhaps based on a specific type of login password or adding something to the login collection. Picture a typical buyer seller scenario. I would like the “seller” roles only to be able to add posts on a particular template and the “buyer” users to be able to add a different kind of posts on a different template.

What would be the easiest way to tackle this?

Thank you.

Jayson


#2

Add the alanning:roles package.


#3

Add alanning:roles then on your server define some allow/deny behaviors with it.

Posts.allow({
  insert: function (userId, doc) {
    return Roles.userIsInRole(userId, 'seller');
  }
});

#4

Great, thank you for the quick response