diff options
Diffstat (limited to 'src/api/routes/stop.ts')
-rw-r--r-- | src/api/routes/stop.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/api/routes/stop.ts b/src/api/routes/stop.ts index 7f8b78ba..78abb9d7 100644 --- a/src/api/routes/stop.ts +++ b/src/api/routes/stop.ts @@ -6,17 +6,19 @@ 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((Number(user.rights) << Number(0))%Number(2)==Number(1)) { + const user = await User.findOneOrFail({ + where: { id: req.user_id }, + select: ["rights"], + }); + 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) - process.kill(process.pid, 'SIGTERM') - } - else { + res.sendStatus(200); + process.kill(process.pid, "SIGTERM"); + } else { console.log("operation failed"); console.log(user.rights); - res.sendStatus(403) + res.sendStatus(403); } }); |