summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-09-24 17:03:41 +0300
committerLauri Ojansivu <x@xet7.org>2017-09-24 17:03:41 +0300
commitcb4a6790506271dfb424efd512f0e7779eaffba1 (patch)
treed63ee5d912e674250dba467c8b0447e30413cce5 /models
parent6addc3c217290419f56da2c8ffac0fe31a715370 (diff)
parent57d6180a7a432f2429e6deab1da1926ec692fd8e (diff)
downloadwekan-cb4a6790506271dfb424efd512f0e7779eaffba1.tar.gz
wekan-cb4a6790506271dfb424efd512f0e7779eaffba1.tar.bz2
wekan-cb4a6790506271dfb424efd512f0e7779eaffba1.zip
Merge branch 'admin-create-user' of https://github.com/soohwa/wekan into soohwa-admin-create-user
Diffstat (limited to 'models')
-rw-r--r--models/users.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/users.js b/models/users.js
index c2238cde..9744d51c 100644
--- a/models/users.js
+++ b/models/users.js
@@ -108,6 +108,10 @@ Users.attachSchema(new SimpleSchema({
type: Boolean,
optional: true,
},
+ fromAdmin: {
+ type: Boolean,
+ optional: false,
+ },
}));
// Search a user in the complete server database by its name or username. This
@@ -435,6 +439,12 @@ if (Meteor.isServer) {
user.isAdmin = true;
return user;
}
+
+ if (options.from == 'admin') {
+ user.fromAdmin = true;
+ return user;
+ }
+
const disableRegistration = Settings.findOne().disableRegistration;
if (!disableRegistration) {
return user;
@@ -524,6 +534,9 @@ if (Meteor.isServer) {
Users.after.insert((userId, doc) => {
+ if (doc.fromAdmin)
+ return;
+
//invite user to corresponding boards
const disableRegistration = Settings.findOne().disableRegistration;
if (disableRegistration) {
@@ -582,6 +595,7 @@ if (Meteor.isServer) {
username: req.body.username,
email: req.body.email,
password: 'default',
+ from: 'admin'
});
JsonRoutes.sendResult(res, {