1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-24 03:12:38 +01:00

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
This commit is contained in:
unknownPerson115 2021-12-28 20:56:43 -06:00 committed by Erkin Alp Güney
parent a57182357d
commit f1b0d552b6

View File

@ -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)