mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	refactor: use helpers.isAllowedTo
This commit is contained in:
		| @@ -77,14 +77,14 @@ privsUsers.canEdit = async function (callerUid, uid) { | |||||||
| 	if (parseInt(callerUid, 10) === parseInt(uid, 10)) { | 	if (parseInt(callerUid, 10) === parseInt(uid, 10)) { | ||||||
| 		return true; | 		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.isAdministrator(callerUid), | ||||||
| 		privsUsers.isGlobalModerator(callerUid), | 		privsUsers.isGlobalModerator(callerUid), | ||||||
| 		privsUsers.isAdministrator(uid), | 		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', { | 	const data = await plugins.hooks.fire('filter:user.canEdit', { | ||||||
| 		isAdmin: isAdmin, | 		isAdmin: isAdmin, | ||||||
| 		isGlobalMod: isGlobalMod, | 		isGlobalMod: isGlobalMod, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user