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