Bläddra i källkod

Merge branch 'admin' of https://github.com/Zokormazo/wekan into Zokormazo-admin

Add Feature: Set admin on first run

Fixes #924
Lauri Ojansivu 8 år sedan
förälder
incheckning
dd40bcf233
1 ändrade filer med 5 tillägg och 1 borttagningar
  1. 5 1
      models/users.js

+ 5 - 1
models/users.js

@@ -104,6 +104,10 @@ Users.attachSchema(new SimpleSchema({
     type: Date,
     type: Date,
     optional: true,
     optional: true,
   },
   },
+  isAdmin: {
+    type: Boolean,
+    optional: true
+  }
 }));
 }));
 
 
 // Search a user in the complete server database by its name or username. This
 // Search a user in the complete server database by its name or username. This
@@ -405,7 +409,7 @@ if (Meteor.isServer) {
   });
   });
   Accounts.onCreateUser((options, user) => {
   Accounts.onCreateUser((options, user) => {
     const userCount = Users.find().count();
     const userCount = Users.find().count();
-    if (userCount === 0){
+    if (!isSandstorm && userCount === 0 ){
       user.isAdmin = true;
       user.isAdmin = true;
       return user;
       return user;
     }
     }