Bypass role handling in development mode

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/3/head
trivernis 4 years ago
parent fcbd65d53b
commit 910e120baf
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -6,6 +6,7 @@ import 'reflect-metadata'
import { createConnection } from 'typeorm' import { createConnection } from 'typeorm'
import { UserServerAPI } from './datasources/userserver/userserviceAPI' import { UserServerAPI } from './datasources/userserver/userserviceAPI'
import express from 'express' import express from 'express'
import { requiredPermissions } from './datasources/userserver/permission'
require('dotenv').config() require('dotenv').config()
@ -17,6 +18,7 @@ require('dotenv').config()
*/ */
async function authenticate (req: any, res: any, next: any) { async function authenticate (req: any, res: any, next: any) {
if (process.env.NODE_ENV === 'develop') { if (process.env.NODE_ENV === 'develop') {
req.permissions = requiredPermissions.map((e) => e.name)
next() next()
} else { } else {
const token = req.headers.authorization?.replace('Bearer ', '') const token = req.headers.authorization?.replace('Bearer ', '')

Loading…
Cancel
Save