Last active
August 29, 2015 14:08
-
-
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!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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