mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +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
|
|
@ -905,6 +905,16 @@ if (Meteor.isServer) {
|
|||
}
|
||||
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) => {
|
||||
const userCount = Users.find().count();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue