Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/middleware/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RequestHandler } from 'express'
import { find } from 'lodash'
import get from 'lodash/get'
import Authz, { getTeamSelfServiceAuthz } from 'src/authz'
import { HttpError } from 'src/error'
import { OpenApiRequestExt } from 'src/otomi-models'
import OtomiStack from 'src/otomi-stack'
import { cleanEnv } from 'src/validators'
Expand Down Expand Up @@ -61,12 +62,8 @@ export function authorize(req: OpenApiRequestExt, res, next, authz: Authz, repoS
else valid = authz.validateWithCasl(action, schemaName, teamId)
const env = cleanEnv({})
// TODO: Debug purpose only for removal of license
if (!env.isDev) {
if (!valid) {
return res
.status(403)
.send({ authz: false, message: `User not allowed to perform "${action}" on "${schemaName}" resource` })
}
if (!env.isDev && !valid) {
throw new HttpError(403, `User not allowed to perform "${action}" on "${schemaName}" resource`)
}

const schemaToRepoMap: Record<string, string> = {
Expand Down
Loading