|
|
|
@ -5,13 +5,13 @@ const { buildMatcherRegex, matches } = require("./matchers") |
|
|
|
module.exports = ( |
|
|
|
allowQueryStringPatterns, |
|
|
|
noTenancyPatterns, |
|
|
|
{ noTenancyRequired } |
|
|
|
opts = {} |
|
|
|
) => { |
|
|
|
const allowQsOptions = buildMatcherRegex(allowQueryStringPatterns) |
|
|
|
const noTenancyOptions = buildMatcherRegex(noTenancyPatterns) |
|
|
|
|
|
|
|
return ContextFactory.getMiddleware(ctx => { |
|
|
|
const allowNoTenant = noTenancyRequired || !!matches(ctx, noTenancyOptions) |
|
|
|
const allowNoTenant = opts.noTenancyRequired || !!matches(ctx, noTenancyOptions) |
|
|
|
const allowQs = !!matches(ctx, allowQsOptions) |
|
|
|
setTenantId(ctx, { allowQs, allowNoTenant }) |
|
|
|
}) |
|
|
|
|