fix(basic.gblib): update ChatServices.ts #420

Closed
eltociear wants to merge 2540 commits from patch-1 into main
Showing only changes of commit a2689c7ce2 - Show all commits

View file

@ -532,24 +532,24 @@ export class DialogKeywords {
* @example ALLOW ROLE "DevOps" * @example ALLOW ROLE "DevOps"
* *
*/ */
public async allowRole({ pid, value }) { public async allowRole({ pid, value: role }) {
const { min, user, proc } = await DialogKeywords.getProcessInfo(pid); const { min, user, proc } = await DialogKeywords.getProcessInfo(pid);
const sys = new SystemKeywords(); const sys = new SystemKeywords();
// Updates current roles allowed from now on this dialog/process. // Updates current roles allowed from now on this dialog/process.
proc.roles = value; proc.roles = role;
// Checks access. // Checks access.
const filters = [`${value}=x`, `id=${user.userSystemId}`]; const filters = [`${role}=x`, `id=${user.userSystemId}`];
const people = sys.find({pid, handle:"People.xlsx", args:[filters]}); const people = await sys.find({pid, handle:"People.xlsx", args:[filters]});
if (!people){ if (!people){
throw new Error(`Invalid access. Check if People sheet has the role ${value} checked.`); throw new Error(`Invalid access. Check if People sheet has the role ${role} checked.`);
} }
GBLogEx.info(min, `Allowed access for ${user.userSystemId} on ${value}`); GBLogEx.info(min, `Allowed access for ${user.userSystemId} on ${role}`);
} }