summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
authorunknownPerson115 <69736850+unknownPerson115@users.noreply.github.com>2021-12-28 20:56:43 -0600
committerErkin Alp Güney <erkinalp9035@gmail.com>2021-12-29 17:42:26 +0300
commit24218eae113ab57af39470294667a2e8e1505c97 (patch)
treeff2211eb0d5cec0aef074d20441c9011200a1a31 /api/src
parentUpdated stop.ts (diff)
downloadserver-24218eae113ab57af39470294667a2e8e1505c97.tar.xz
Updated stop.ts
now using bitwise operators and dividing the `rights` value so you can have other rights whilst having the `OPERATOR` right

for example: `3` is `1` and `2` combined

NOTE: a potential issue has been uncovered while testing; if you have more than 1 thread the server will only stop 1 thread and the rest of the server will continue to run
Diffstat (limited to 'api/src')
-rw-r--r--api/src/routes/stop.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/api/src/routes/stop.ts b/api/src/routes/stop.ts
index a9024350..7f8b78ba 100644
--- a/api/src/routes/stop.ts
+++ b/api/src/routes/stop.ts
@@ -7,7 +7,7 @@ const router: Router = Router();
 router.post("/", route({}), async (req: Request, res: Response) => {
 	//EXPERIMENTAL: have an "OPERATOR" platform permission implemented for this API route
 	const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["rights"] });
-	if(user.rights == '1') {
+	if((Number(user.rights) << Number(0))%Number(2)==Number(1)) {
 		console.log("user that POSTed to the API was ALLOWED");
 		console.log(user.rights);
 		res.sendStatus(200)