|
|
@ -25,21 +25,23 @@ export default function(handlerFn, permissionName) { |
|
|
|
NcError.unauthorized('Unauthorized access'); |
|
|
|
NcError.unauthorized('Unauthorized access'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// check if the token is still valid
|
|
|
|
// check if the token is still valid for non-public base
|
|
|
|
const email = req?.session?.passport?.user?.email; |
|
|
|
if (!req?.session?.passport?.user?.isPublicBase) { |
|
|
|
let user = |
|
|
|
const email = req?.session?.passport?.user?.email; |
|
|
|
email && |
|
|
|
let user = |
|
|
|
(await NocoCache.get( |
|
|
|
email && |
|
|
|
`${CacheScope.USER}:${email}`, |
|
|
|
(await NocoCache.get( |
|
|
|
CacheGetType.TYPE_OBJECT |
|
|
|
`${CacheScope.USER}:${email}`, |
|
|
|
)); |
|
|
|
CacheGetType.TYPE_OBJECT |
|
|
|
if (!user) { |
|
|
|
)); |
|
|
|
user = await Noco.ncMeta.metaGet2(null, null, MetaTable.USERS, { |
|
|
|
if (!user) { |
|
|
|
email |
|
|
|
user = await Noco.ncMeta.metaGet2(null, null, MetaTable.USERS, { |
|
|
|
}); |
|
|
|
email |
|
|
|
} |
|
|
|
}); |
|
|
|
if (user.token_expired) { |
|
|
|
} |
|
|
|
NcError.unauthorized('Token Expired. Please login again.'); |
|
|
|
if (user.token_expired) { |
|
|
|
|
|
|
|
NcError.unauthorized('Token Expired. Please login again.'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
next(); |
|
|
|
next(); |
|
|
|
}), |
|
|
|
}), |
|
|
|