mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
19 lines
340 B
JavaScript
Executable File
19 lines
340 B
JavaScript
Executable File
import { User } from "@db_models"
|
|
|
|
export default async (user_id) => {
|
|
if (!user_id) {
|
|
throw new Error("Missing user id")
|
|
}
|
|
|
|
const user = await User.findById(user_id)
|
|
|
|
if (!user) {
|
|
throw new Error("User not found")
|
|
}
|
|
|
|
if (!user.roles.includes("admin")) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
} |