mirror of
https://github.com/wekan/wekan.git
synced 2026-02-12 19:24:20 +01:00
Merge branch 'admin-create-user' of https://github.com/soohwa/wekan into soohwa-admin-create-user
This commit is contained in:
commit
cb4a679050
1 changed files with 14 additions and 0 deletions
|
|
@ -108,6 +108,10 @@ Users.attachSchema(new SimpleSchema({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
fromAdmin: {
|
||||||
|
type: Boolean,
|
||||||
|
optional: false,
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -435,6 +439,12 @@ if (Meteor.isServer) {
|
||||||
user.isAdmin = true;
|
user.isAdmin = true;
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.from == 'admin') {
|
||||||
|
user.fromAdmin = true;
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
const disableRegistration = Settings.findOne().disableRegistration;
|
const disableRegistration = Settings.findOne().disableRegistration;
|
||||||
if (!disableRegistration) {
|
if (!disableRegistration) {
|
||||||
return user;
|
return user;
|
||||||
|
|
@ -524,6 +534,9 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
Users.after.insert((userId, doc) => {
|
Users.after.insert((userId, doc) => {
|
||||||
|
|
||||||
|
if (doc.fromAdmin)
|
||||||
|
return;
|
||||||
|
|
||||||
//invite user to corresponding boards
|
//invite user to corresponding boards
|
||||||
const disableRegistration = Settings.findOne().disableRegistration;
|
const disableRegistration = Settings.findOne().disableRegistration;
|
||||||
if (disableRegistration) {
|
if (disableRegistration) {
|
||||||
|
|
@ -582,6 +595,7 @@ if (Meteor.isServer) {
|
||||||
username: req.body.username,
|
username: req.body.username,
|
||||||
email: req.body.email,
|
email: req.body.email,
|
||||||
password: 'default',
|
password: 'default',
|
||||||
|
from: 'admin'
|
||||||
});
|
});
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue