diff options
author | unknownPerson115 <69736850+unknownPerson115@users.noreply.github.com> | 2021-12-28 20:56:43 -0600 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2021-12-29 17:42:26 +0300 |
commit | f1b0d552b6a7110f3d4604b8b39383d75bbead98 (patch) | |
tree | da08e12500a0056e98c610c46aaa652e48640bc5 | |
parent | Updated stop.ts (diff) | |
download | server-f1b0d552b6a7110f3d4604b8b39383d75bbead98.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
-rw-r--r-- | api/src/routes/stop.ts | 2 |
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) |