20 lines
526 B
TypeScript
20 lines
526 B
TypeScript
export type HiddenModelAccessInput = {
|
|
sessionUserType?: string | null;
|
|
databaseUserRole?: string | null;
|
|
isHighVip?: boolean | null;
|
|
};
|
|
|
|
const HIDDEN_MODEL_ADMIN_ROLES = new Set(["admin", "agent_admin"]);
|
|
|
|
export function canAccessHiddenAiModels({
|
|
sessionUserType,
|
|
databaseUserRole,
|
|
isHighVip,
|
|
}: HiddenModelAccessInput) {
|
|
return (
|
|
isHighVip === true ||
|
|
HIDDEN_MODEL_ADMIN_ROLES.has(String(databaseUserRole || "").trim()) ||
|
|
HIDDEN_MODEL_ADMIN_ROLES.has(String(sessionUserType || "").trim())
|
|
);
|
|
}
|