mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Add admin ability : Impersonate one user.
This commit is contained in:
parent
8f6c3550e3
commit
d19cc972e0
5 changed files with 859 additions and 821 deletions
|
|
@ -104,6 +104,8 @@ template(name="peopleRow")
|
||||||
a.edit-user
|
a.edit-user
|
||||||
i.fa.fa-edit
|
i.fa.fa-edit
|
||||||
| {{_ 'edit'}}
|
| {{_ 'edit'}}
|
||||||
|
a.more-settings-user
|
||||||
|
i.fa.fa-ellipsis-h
|
||||||
|
|
||||||
template(name="editUserPopup")
|
template(name="editUserPopup")
|
||||||
form
|
form
|
||||||
|
|
@ -200,3 +202,10 @@ template(name="newUserPopup")
|
||||||
input.js-profile-password(type="password")
|
input.js-profile-password(type="password")
|
||||||
div.buttonsContainer
|
div.buttonsContainer
|
||||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||||
|
|
||||||
|
template(name="settingsUserPopup")
|
||||||
|
ul.pop-over-list
|
||||||
|
li
|
||||||
|
a.impersonate-user
|
||||||
|
i.fa.fa-user
|
||||||
|
| {{_ 'impersonate-user'}}
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ BlazeComponent.extendComponent({
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'click a.edit-user': Popup.open('editUser'),
|
'click a.edit-user': Popup.open('editUser'),
|
||||||
|
'click a.more-settings-user': Popup.open('settingsUser'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
@ -343,3 +344,16 @@ Template.newUserPopup.events({
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.settingsUserPopup.events({
|
||||||
|
'click .impersonate-user'(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
Meteor.call('impersonate', this.userId, err => {
|
||||||
|
if (!err) {
|
||||||
|
FlowRouter.go('/');
|
||||||
|
Meteor.connection.setUserId(this.userId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -46,3 +46,6 @@ table
|
||||||
|
|
||||||
div
|
div
|
||||||
margin: auto
|
margin: auto
|
||||||
|
|
||||||
|
.more-settings-user
|
||||||
|
margin-left: 10px;
|
||||||
|
|
|
||||||
|
|
@ -474,6 +474,7 @@
|
||||||
"search-cards": "Search from card/list titles, descriptions and custom fields on this board",
|
"search-cards": "Search from card/list titles, descriptions and custom fields on this board",
|
||||||
"search-example": "Write text you search and press Enter",
|
"search-example": "Write text you search and press Enter",
|
||||||
"select-color": "Select Colour",
|
"select-color": "Select Colour",
|
||||||
|
"settingsUserPopup-title": "More actions",
|
||||||
"set-wip-limit-value": "Set a limit for the maximum number of tasks in this list",
|
"set-wip-limit-value": "Set a limit for the maximum number of tasks in this list",
|
||||||
"setWipLimitPopup-title": "Set WIP Limit",
|
"setWipLimitPopup-title": "Set WIP Limit",
|
||||||
"shortcut-assign-self": "Assign yourself to current card",
|
"shortcut-assign-self": "Assign yourself to current card",
|
||||||
|
|
@ -493,6 +494,7 @@
|
||||||
"starred-boards": "Starred Boards",
|
"starred-boards": "Starred Boards",
|
||||||
"starred-boards-description": "Starred boards show up at the top of your boards list.",
|
"starred-boards-description": "Starred boards show up at the top of your boards list.",
|
||||||
"subscribe": "Subscribe",
|
"subscribe": "Subscribe",
|
||||||
|
"impersonate-user": "Impersonate",
|
||||||
"team": "Team",
|
"team": "Team",
|
||||||
"this-board": "this board",
|
"this-board": "this board",
|
||||||
"this-card": "this card",
|
"this-card": "this card",
|
||||||
|
|
|
||||||
|
|
@ -905,6 +905,16 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
return { username: user.username, email: user.emails[0].address };
|
return { username: user.username, email: user.emails[0].address };
|
||||||
},
|
},
|
||||||
|
impersonate(userId) {
|
||||||
|
check(userId, String);
|
||||||
|
|
||||||
|
if (!Meteor.users.findOne(userId))
|
||||||
|
throw new Meteor.Error(404, 'User not found');
|
||||||
|
if (!Meteor.user().isAdmin)
|
||||||
|
throw new Meteor.Error(403, 'Permission denied');
|
||||||
|
|
||||||
|
this.setUserId(userId);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
Accounts.onCreateUser((options, user) => {
|
Accounts.onCreateUser((options, user) => {
|
||||||
const userCount = Users.find().count();
|
const userCount = Users.find().count();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue