Fix currentapp middleware to allow app_ parameters
This commit is contained in:
parent
d11d635904
commit
24f8f3a7cb
|
@ -25,6 +25,7 @@ export default async (ctx: BBContext, next: any) => {
|
||||||
if (!appCookie && !requestAppId) {
|
if (!appCookie && !requestAppId) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the app exists referenced in cookie
|
// check the app exists referenced in cookie
|
||||||
if (appCookie) {
|
if (appCookie) {
|
||||||
const appId = appCookie.appId
|
const appId = appCookie.appId
|
||||||
|
@ -51,7 +52,7 @@ export default async (ctx: BBContext, next: any) => {
|
||||||
|
|
||||||
let appId: string | undefined,
|
let appId: string | undefined,
|
||||||
roleId = roles.BUILTIN_ROLE_IDS.PUBLIC
|
roleId = roles.BUILTIN_ROLE_IDS.PUBLIC
|
||||||
if (!ctx.user) {
|
if (!ctx.user?._id) {
|
||||||
// not logged in, try to set a cookie for public apps
|
// not logged in, try to set a cookie for public apps
|
||||||
appId = requestAppId
|
appId = requestAppId
|
||||||
} else if (requestAppId != null) {
|
} else if (requestAppId != null) {
|
||||||
|
@ -96,7 +97,7 @@ export default async (ctx: BBContext, next: any) => {
|
||||||
// need to judge this only based on the request app ID,
|
// need to judge this only based on the request app ID,
|
||||||
if (
|
if (
|
||||||
env.MULTI_TENANCY &&
|
env.MULTI_TENANCY &&
|
||||||
ctx.user &&
|
ctx.user?._id &&
|
||||||
requestAppId &&
|
requestAppId &&
|
||||||
!tenancy.isUserInAppTenant(requestAppId, ctx.user)
|
!tenancy.isUserInAppTenant(requestAppId, ctx.user)
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue