fix(core.gbapp): FIX SSR errors and setOption impersonated.
This commit is contained in:
parent
19e1292693
commit
e596f31de6
2 changed files with 27 additions and 9 deletions
|
@ -557,20 +557,34 @@ export class DialogKeywords {
|
||||||
// throw new Error(`Not possible to define ${name} as it is a reserved system param name.`);
|
// throw new Error(`Not possible to define ${name} as it is a reserved system param name.`);
|
||||||
// }
|
// }
|
||||||
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
||||||
const sec = new SecService();
|
|
||||||
await sec.setParam(user.userId, name , value);
|
|
||||||
GBLog.info(`BASIC: ${name} = ${value} (botId: ${min.botId})`);
|
GBLog.info(`BASIC: ${name} = ${value} (botId: ${min.botId})`);
|
||||||
|
const sec = new SecService();
|
||||||
|
if (user)
|
||||||
|
{
|
||||||
|
await sec.setParam(user.userId, name , value);
|
||||||
return { min, user, params };
|
return { min, user, params };
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
min[name] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static async getOption({ pid, name }) {
|
public static async getOption({ pid, name }) {
|
||||||
if (this.isUserSystemParam(name)) {
|
if (this.isUserSystemParam(name)) {
|
||||||
throw new Error(`Not possible to retrieve ${name} system param.`);
|
throw new Error(`Not possible to retrieve ${name} system param.`);
|
||||||
}
|
}
|
||||||
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
||||||
|
|
||||||
|
if (user){
|
||||||
const sec = new SecService();
|
const sec = new SecService();
|
||||||
return await sec.getParam(user, name);
|
return await sec.getParam(user, name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return min[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the maximum lines to scan in spreedsheets.
|
* Defines the maximum lines to scan in spreedsheets.
|
||||||
|
|
|
@ -284,10 +284,14 @@ export class GBSSR {
|
||||||
// Tries to find botId from URL.
|
// Tries to find botId from URL.
|
||||||
|
|
||||||
const minBoot = GBServer.globals.minBoot;
|
const minBoot = GBServer.globals.minBoot;
|
||||||
let botId =
|
let botId = minBoot.botId;
|
||||||
req.originalUrl && req.originalUrl === '/' ?
|
if (req.originalUrl && req.originalUrl === '/') {
|
||||||
minBoot.botId :
|
let tmp = /\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl);
|
||||||
/\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl)[1]
|
if (tmp) {
|
||||||
|
botId = tmp[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let min: GBMinInstance =
|
let min: GBMinInstance =
|
||||||
req.url === '/'
|
req.url === '/'
|
||||||
? minBoot
|
? minBoot
|
||||||
|
|
Loading…
Add table
Reference in a new issue