2
0
Эх сурвалжийг харах

Merge branch 'Zokormazo-admin' into devel

Set first user as admin, it there is no existing
users and Wekan is not running at Sandstorm.

Fixes #924
Lauri Ojansivu 8 жил өмнө
parent
commit
b242f49d7c
2 өөрчлөгдсөн 18 нэмэгдсэн , 1 устгасан
  1. 13 0
      CHANGELOG.md
  2. 5 1
      models/users.js

+ 13 - 0
CHANGELOG.md

@@ -1,3 +1,16 @@
+# Upcoming Wekan release
+
+Known bugs:
+
+* https://github.com/wekan/wekan/issues/784
+
+This release adds the following new features:
+
+* Set first user as admin, it there is no existing
+  users and Wekan is not running at Sandstorm.
+
+Thanks to GitHub user Zokormazo for contributions.
+
 # v0.18 2017-04-02 Wekan release
 
 Known bugs:

+ 5 - 1
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
@@ -405,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;
     }