Add ability to add manually choose who can submit chapters

This commit is contained in:
Ajay
2022-07-06 00:11:45 -04:00
parent 47f460bb2c
commit c2b0ecd6f6
14 changed files with 292 additions and 22 deletions

11
src/utils/permissions.ts Normal file
View File

@@ -0,0 +1,11 @@
import { config } from "../config";
import { Feature, HashedUserID } from "../types/user.model";
import { hasFeature } from "./features";
import { isUserVIP } from "./isUserVIP";
import { getReputation } from "./reputation";
export async function canSubmitChapter(userID: HashedUserID): Promise<boolean> {
return (await isUserVIP(userID))
|| (await getReputation(userID)) > config.minReputationToSubmitChapter
|| (await hasFeature(userID, Feature.ChapterSubmitter));
}