parent
16a58b5015
commit
3925e8917a
@ -0,0 +1,6 @@ |
||||
Meteor.methods({ |
||||
unsetUserReason(userId) { |
||||
Meteor.users.update(userId, { $unset: { 'reason' : 1 } }); |
||||
return true; |
||||
} |
||||
}); |
||||
@ -0,0 +1,27 @@ |
||||
Meteor.methods({ |
||||
unsetUserReason(userId) { |
||||
check(userId, String); |
||||
|
||||
if (!Meteor.userId()) { |
||||
throw new Meteor.Error('error-invalid-user', 'Invalid user', { |
||||
method: 'unsetUserReason' |
||||
}); |
||||
} |
||||
|
||||
if (RocketChat.authz.hasPermission(Meteor.userId(), 'edit-other-user-active-status') !== true) { |
||||
throw new Meteor.Error('error-not-allowed', 'Not allowed', { |
||||
method: 'unsetUserReason' |
||||
}); |
||||
} |
||||
|
||||
const user = RocketChat.models.Users.findOneById(userId); |
||||
|
||||
if (user) { |
||||
RocketChat.models.Users.unsetReason(userId); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
}); |
||||
Loading…
Reference in new issue