From 1218e114beb8cb4428c5bf43a76382981b89d09a Mon Sep 17 00:00:00 2001 From: Julen Landa Alustiza Date: Sun, 2 Apr 2017 12:55:13 +0200 Subject: [PATCH 1/2] Add isAdmin to user Schema --- models/users.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/users.js b/models/users.js index 7b484f920..b06a64603 100644 --- a/models/users.js +++ b/models/users.js @@ -104,6 +104,10 @@ Users.attachSchema(new SimpleSchema({ type: Date, optional: true, }, + isAdmin: { + type: Boolean, + optional: true + } })); // Search a user in the complete server database by its name or username. This From 28a1dd677c19d319148168a15f423721c8b95ed6 Mon Sep 17 00:00:00 2001 From: Julen Landa Alustiza Date: Sun, 2 Apr 2017 16:29:51 +0200 Subject: [PATCH 2/2] First user is admin only if not running in sandstorm --- models/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/users.js b/models/users.js index b06a64603..236feb45a 100644 --- a/models/users.js +++ b/models/users.js @@ -409,7 +409,7 @@ if (Meteor.isServer) { }); Accounts.onCreateUser((options, user) => { const userCount = Users.find().count(); - if (userCount === 0){ + if (!isSandstorm && userCount === 0 ){ user.isAdmin = true; return user; }