Skip to content

Instantly share code, notes, and snippets.

@bdunnette
Last active August 29, 2015 14:08
Show Gist options
  • Save bdunnette/9cebb42cb933619cec13 to your computer and use it in GitHub Desktop.
Save bdunnette/9cebb42cb933619cec13 to your computer and use it in GitHub Desktop.
Make the first user of your Meteor app an admin - just put the following in your /server directory!
Accounts.onLogin(function (users) {
/* if there's only one user, add that user to admin group */
if (Meteor.users.find().count() === 1) {
Roles.addUsersToRoles(users.user._id, ['admin']);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment