summary refs log tree commit diff
path: root/src/util/util/Rights.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util/Rights.ts')
-rw-r--r--src/util/util/Rights.ts29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/util/util/Rights.ts b/src/util/util/Rights.ts
index 90ebe242..e154d927 100644
--- a/src/util/util/Rights.ts
+++ b/src/util/util/Rights.ts
@@ -22,12 +22,7 @@ import { BitFieldResolvable, BitFlag } from "./BitField";
 import { User } from "../entities";
 import { HTTPError } from "lambert-server";
 
-export type RightResolvable =
-	| bigint
-	| number
-	| Rights
-	| RightResolvable[]
-	| RightString;
+export type RightResolvable = bigint | number | Rights | RightResolvable[] | RightString;
 
 type RightString = keyof typeof Rights.FLAGS;
 // TODO: just like roles for members, users should have privilidges which combine multiple rights into one and make it easy to assign
@@ -97,35 +92,23 @@ export class Rights extends BitField {
 	};
 
 	any(permission: RightResolvable, checkOperator = true) {
-		return (
-			(checkOperator && super.any(Rights.FLAGS.OPERATOR)) ||
-			super.any(permission)
-		);
+		return (checkOperator && super.any(Rights.FLAGS.OPERATOR)) || super.any(permission);
 	}
 
 	has(permission: RightResolvable, checkOperator = true) {
-		return (
-			(checkOperator && super.has(Rights.FLAGS.OPERATOR)) ||
-			super.has(permission)
-		);
+		return (checkOperator && super.has(Rights.FLAGS.OPERATOR)) || super.has(permission);
 	}
 
 	hasThrow(permission: RightResolvable) {
 		if (this.has(permission)) return true;
-		throw new HTTPError(
-			`You are missing the following rights ${permission}`,
-			403,
-		);
+		throw new HTTPError(`You are missing the following rights ${permission}`, 403);
 	}
 }
 
-const ALL_RIGHTS = Object.values(Rights.FLAGS).reduce(
-	(total, val) => total | val,
-	BigInt(0),
-);
+const ALL_RIGHTS = Object.values(Rights.FLAGS).reduce((total, val) => total | val, BigInt(0));
 
 export async function getRights(
-	user_id: string,
+	user_id: string
 	/**, opts: {
 		in_behalf?: (keyof User)[];
 	} = {} **/