Add new importUsernames field for import user mapping

This commit is contained in:
John R. Supplee 2021-01-30 02:35:29 +02:00
parent 62ba8ed8d8
commit 0446999c63
7 changed files with 68 additions and 7 deletions

View file

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

View file

@ -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 <s>{{_ userData.authenticationMethod }}</s>
else
td {{_ userData.authenticationMethod }}
if userData.loginDisabled
td <s>{{ userData.importUsernamesString }}</s>
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

View file

@ -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');