|
|
@ -592,14 +592,20 @@ export default class RestAuthCtrl { |
|
|
|
new CustomStrategy(async (req: any, callback) => { |
|
|
|
new CustomStrategy(async (req: any, callback) => { |
|
|
|
let user; |
|
|
|
let user; |
|
|
|
if (req.headers['xc-shared-base-id']) { |
|
|
|
if (req.headers['xc-shared-base-id']) { |
|
|
|
const sharedBase = await this.xcMeta |
|
|
|
const cacheKey = `nc_shared_bases||${req.headers['xc-shared-base-id']}`; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let sharedBase = XcCache.get(cacheKey); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!sharedBase) { |
|
|
|
|
|
|
|
sharedBase = await this.xcMeta |
|
|
|
.knex('nc_shared_bases') |
|
|
|
.knex('nc_shared_bases') |
|
|
|
.where({ |
|
|
|
.where({ |
|
|
|
enabled: true, |
|
|
|
enabled: true, |
|
|
|
shared_base_id: req.headers['xc-shared-base-id'] |
|
|
|
shared_base_id: req.headers['xc-shared-base-id'] |
|
|
|
}) |
|
|
|
}) |
|
|
|
.first(); |
|
|
|
.first(); |
|
|
|
|
|
|
|
XcCache.set(cacheKey, sharedBase); |
|
|
|
|
|
|
|
} |
|
|
|
user = { |
|
|
|
user = { |
|
|
|
roles: sharedBase?.roles |
|
|
|
roles: sharedBase?.roles |
|
|
|
}; |
|
|
|
}; |
|
|
|