mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: #8135
This commit is contained in:
		| @@ -53,6 +53,11 @@ module.exports = function (Groups) { | |||||||
| 		return Array.isArray(groupsData) && groupsData[0] ? groupsData[0] : null; | 		return Array.isArray(groupsData) && groupsData[0] ? groupsData[0] : null; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	Groups.getGroupField = async function (groupName, field) { | ||||||
|  | 		const groupData = await Groups.getGroupFields(groupName, [field]); | ||||||
|  | 		return groupData ? groupData[field] : null; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| 	Groups.getGroupFields = async function (groupName, fields) { | 	Groups.getGroupFields = async function (groupName, fields) { | ||||||
| 		const groups = await Groups.getGroupsFields([groupName], fields); | 		const groups = await Groups.getGroupsFields([groupName], fields); | ||||||
| 		return groups ? groups[0] : null; | 		return groups ? groups[0] : null; | ||||||
|   | |||||||
| @@ -375,10 +375,12 @@ async function canModifyGroup(uid, groupName) { | |||||||
| 	} | 	} | ||||||
| 	const results = await utils.promiseParallel({ | 	const results = await utils.promiseParallel({ | ||||||
| 		isOwner: groups.ownership.isOwner(uid, groupName), | 		isOwner: groups.ownership.isOwner(uid, groupName), | ||||||
| 		isAdminOrGlobalMod: user.isAdminOrGlobalMod(uid), | 		system: groups.getGroupField(groupName, 'system'), | ||||||
|  | 		isAdmin: user.isAdministrator(uid), | ||||||
|  | 		isGlobalMod: user.isGlobalModerator(uid), | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	if (!results.isOwner && !results.isAdminOrGlobalMod) { | 	if (!(results.isOwner || results.isAdmin || (results.isGlobalMod && !results.system))) { | ||||||
| 		throw new Error('[[error:no-privileges]]'); | 		throw new Error('[[error:no-privileges]]'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user