mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #10906, allow middleware.checkAccountPermissions to be called with either uid or userslug in params
Previously, the middleware only worked with userslug params
This commit is contained in:
@@ -165,7 +165,11 @@ module.exports = function (middleware) {
|
||||
return controllers.helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
const uid = await user.getUidByUserslug(req.params.userslug);
|
||||
if (!['uid', 'userslug'].some(param => req.params.hasOwnProperty(param))) {
|
||||
return controllers.helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
const uid = req.params.uid || await user.getUidByUserslug(req.params.userslug);
|
||||
let allowed = await privileges.users.canEdit(req.uid, uid);
|
||||
if (allowed) {
|
||||
return next();
|
||||
|
||||
Reference in New Issue
Block a user