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
This commit is contained in:
Lauri Ojansivu 2017-04-02 17:44:04 +03:00
commit b242f49d7c
2 changed files with 18 additions and 1 deletions

View file

@ -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:

View file

@ -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;
}