diff --git a/client/components/import/import.js b/client/components/import/import.js
index f97ab508d..2ebe0b3ec 100644
--- a/client/components/import/import.js
+++ b/client/components/import/import.js
@@ -169,7 +169,10 @@ BlazeComponent.extendComponent({
this._refreshMembers(
this.members().map(member => {
if (!member.wekanId) {
- const user = Users.findOne({ username: member.username });
+ let user = Users.findOne({ username: member.username });
+ if (!user) {
+ user = Users.findOne({ importUsernames: member.username });
+ }
if (user) {
// eslint-disable-next-line no-console
console.log('found username:', user.username);
diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade
index 3330b343c..81a48c774 100644
--- a/client/components/settings/peopleBody.jade
+++ b/client/components/settings/peopleBody.jade
@@ -110,6 +110,7 @@ template(name="peopleGeneral")
th {{_ 'createdAt'}}
th {{_ 'active'}}
th {{_ 'authentication-method'}}
+ th {{_ 'import-usernames'}}
th
+newUserRow
each user in peopleList
@@ -257,6 +258,10 @@ template(name="peopleRow")
td {{_ userData.authenticationMethod }}
else
td {{_ userData.authenticationMethod }}
+ if userData.loginDisabled
+ td {{ userData.importUsernamesString }}
+ else
+ td {{ userData.importUsernamesString }}
td
a.edit-user
i.fa.fa-edit
@@ -346,6 +351,9 @@ template(name="editUserPopup")
input.js-profile-email(type="email" value="{{user.emails.[0].address}}" readonly)
else
input.js-profile-email(type="email" value="{{user.emails.[0].address}}" required)
+ label
+ | {{_ 'import-usernames'}}
+ input.js-import-usernames(type="text" value=user.importUsernames)
label
| {{_ 'verified'}}
select.select-verified.js-profile-email-verified
@@ -444,6 +452,9 @@ template(name="newUserPopup")
// input.js-profile-email(type="email" value="{{user.emails.[0].address}}" readonly)
//else
input.js-profile-email(type="email" value="" required)
+ label
+ | {{_ 'import-usernames'}}
+ input.js-import-usernames(type="text" value="")
label
| {{_ 'admin'}}
select.select-role.js-profile-isadmin
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index 42a692eb3..9f4886190 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -143,7 +143,7 @@ BlazeComponent.extendComponent({
const orgs = Org.find(this.findOrgsOptions.get(), {
fields: { _id: true },
});
- this.numberOrgs.set(org.count(false));
+ this.numberOrgs.set(orgs.count(false));
return orgs;
},
teamList() {
@@ -421,6 +421,9 @@ Template.editUserPopup.events({
const authentication = templateInstance
.find('.js-authenticationMethod')
.value.trim();
+ const importUsernames = templateInstance
+ .find('.js-import-usernames')
+ .value.trim();
const isChangePassword = password.length > 0;
const isChangeUserName = username !== user.username;
@@ -441,6 +444,7 @@ Template.editUserPopup.events({
isAdmin: isAdmin === 'true',
loginDisabled: isActive === 'true',
authenticationMethod: authentication,
+ importUsernames: Users.parseImportUsernames(importUsernames),
},
});
@@ -563,6 +567,9 @@ Template.newUserPopup.events({
const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
const isActive = templateInstance.find('.js-profile-isactive').value.trim();
const email = templateInstance.find('.js-profile-email').value.trim();
+ const importUsernames = templateInstance
+ .find('.js-import-usernames')
+ .value.trim();
Meteor.call(
'setCreateUser',
@@ -572,6 +579,7 @@ Template.newUserPopup.events({
isAdmin,
isActive,
email.toLowerCase(),
+ importUsernames,
function(error) {
const usernameMessageElement = templateInstance.$('.username-taken');
const emailMessageElement = templateInstance.$('.email-taken');
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index accf914f4..72eb477c2 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -530,6 +530,7 @@
"custom-login-logo-link-url": "Custom Login Logo Link URL",
"text-below-custom-login-logo": "Text below Custom Login Logo",
"username": "Username",
+ "import-usernames": "Import Usernames",
"view-it": "View it",
"warn-list-archived": "warning: this card is in an list at Archive",
"watch": "Watch",
diff --git a/models/users.js b/models/users.js
index a9bb0f53c..9bf588e5b 100644
--- a/models/users.js
+++ b/models/users.js
@@ -338,6 +338,13 @@ Users.attachSchema(
type: Number,
optional: true,
},
+ importUsernames: {
+ /**
+ * username for imported
+ */
+ type: [String],
+ optional: true,
+ },
}),
);
@@ -433,7 +440,18 @@ if (Meteor.isClient) {
});
}
+Users.parseImportUsernames = usernamesString => {
+ return usernamesString.trim().split(new RegExp('\\s*[,;]\\s*'));
+};
+
Users.helpers({
+ importUsernamesString() {
+ if (this.importUsernames) {
+ return this.importUsernames.join(', ');
+ }
+ return '';
+ },
+
boards() {
return Boards.find(
{ 'members.userId': this._id },
@@ -779,7 +797,15 @@ Meteor.methods({
if (Meteor.isServer) {
Meteor.methods({
- setCreateUser(fullname, username, password, isAdmin, isActive, email) {
+ setCreateUser(
+ fullname,
+ username,
+ password,
+ isAdmin,
+ isActive,
+ email,
+ importUsernames,
+ ) {
if (Meteor.user() && Meteor.user().isAdmin) {
check(fullname, String);
check(username, String);
@@ -787,6 +813,7 @@ if (Meteor.isServer) {
check(isAdmin, String);
check(isActive, String);
check(email, String);
+ check(importUsernames, Array);
const nUsersWithUsername = Users.find({ username }).count();
const nUsersWithEmail = Users.find({ email }).count();
@@ -803,10 +830,10 @@ if (Meteor.isServer) {
email: email.toLowerCase(),
from: 'admin',
});
- user = Users.findOne(username) || Users.findOne({ username });
+ const user = Users.findOne(username) || Users.findOne({ username });
if (user) {
Users.update(user._id, {
- $set: { 'profile.fullname': fullname },
+ $set: { 'profile.fullname': fullname, importUsernames },
});
}
}
diff --git a/server/publications/people.js b/server/publications/people.js
index 6ca454c26..b2318287c 100644
--- a/server/publications/people.js
+++ b/server/publications/people.js
@@ -20,6 +20,7 @@ Meteor.publish('people', function(query, limit) {
createdAt: 1,
loginDisabled: 1,
authenticationMethod: 1,
+ importUsernames: 1,
},
});
}
diff --git a/server/publications/users.js b/server/publications/users.js
index 42861d355..152669064 100644
--- a/server/publications/users.js
+++ b/server/publications/users.js
@@ -4,8 +4,18 @@ Meteor.publish('user-miniprofile', function(usernames) {
// eslint-disable-next-line no-console
// console.log('usernames:', usernames);
return Users.find(
- { username: { $in: usernames } },
- { fields: Users.safeFields },
+ {
+ $or: [
+ { username: { $in: usernames } },
+ { importUsernames: { $in: usernames } },
+ ],
+ },
+ {
+ fields: {
+ ...Users.safeFields,
+ importUsernames: 1,
+ },
+ },
);
});