Skip to content

Instantly share code, notes, and snippets.

@themeteorchef
Created January 22, 2016 21:15
Show Gist options
  • Save themeteorchef/2c8a293435fb44e0c034 to your computer and use it in GitHub Desktop.
Save themeteorchef/2c8a293435fb44e0c034 to your computer and use it in GitHub Desktop.
Roles Example
Companies = new Meteor.Collection();
{
"Company 1": {
_id: "companyOne",
roles: [
'bacon',
'eggs',
'biscuits'
]
}
"Company 2": {
_id: "companyTwo",
roles: {
"admins": [
'apples',
'oranges',
'bananas'
],
"employees": [
'yahtzee',
'monopoly',
'jenga'
]
}
}
"Company 3": {}
"Company 4": {}
}
{ _id: "dougbacon" email: "[email protected]", roles: [ 'bacon', 'eggs' ] }
{ _id: "janeapples" email: "[email protected]", roles: [ 'apples' ] }
Roles.addUsersToRoles( "janeapples", [ 'oranges' ] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment