mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-30 03:37:12 -04:00
9 lines
317 B
TypeScript
9 lines
317 B
TypeScript
import {APIErrors} from 'common/api/utils'
|
|
import {isAdminId, isModId} from 'common/envs/constants'
|
|
|
|
export const throwErrorIfNotMod = async (userId: string) => {
|
|
if (!isAdminId(userId) && !isModId(userId)) {
|
|
throw APIErrors.forbidden(`User ${userId} must be an admin or trusted to perform this action.`)
|
|
}
|
|
}
|