Skip to content

Commit

Permalink
refactor: use helpers.isAllowedTo
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 4, 2023
1 parent 344ece8 commit 47c16e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/privileges/users.js
Expand Up @@ -77,14 +77,14 @@ privsUsers.canEdit = async function (callerUid, uid) {
if (parseInt(callerUid, 10) === parseInt(uid, 10)) {
return true;
}
const privsAdmin = require('./admin');
const [isAdmin, isGlobalMod, isTargetAdmin, canManageUsers] = await Promise.all([

const [isAdmin, isGlobalMod, isTargetAdmin, isUserAllowedTo] = await Promise.all([
privsUsers.isAdministrator(callerUid),
privsUsers.isGlobalModerator(callerUid),
privsUsers.isAdministrator(uid),
privsAdmin.can('admin:users', callerUid),
helpers.isAllowedTo('admin:users', callerUid, [0]),
]);

const canManageUsers = isUserAllowedTo[0];
const data = await plugins.hooks.fire('filter:user.canEdit', {
isAdmin: isAdmin,
isGlobalMod: isGlobalMod,
Expand Down

0 comments on commit 47c16e9

Please sign in to comment.