From aeb2a526d342d45125e241b43373c97374a76d64 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 26 Dec 2024 16:30:57 +0530 Subject: [PATCH] avniproject/avni-server#841 - add token to the params --- .../openchs-android/src/service/RuleEvaluationService.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/openchs-android/src/service/RuleEvaluationService.js b/packages/openchs-android/src/service/RuleEvaluationService.js index 2c05d3327..a27ef41ff 100644 --- a/packages/openchs-android/src/service/RuleEvaluationService.js +++ b/packages/openchs-android/src/service/RuleEvaluationService.js @@ -47,6 +47,7 @@ import {Groups, ReportCardResult, NestedReportCardResult} from "openchs-models"; import {JSONStringify} from "../utility/JsonStringify"; import UserInfoService from "./UserInfoService"; import PrivilegeService from './PrivilegeService'; +import AuthService from "./AuthService"; function getImports() { return {rulesConfig, common, lodash, moment, motherCalculations, log: console.log}; @@ -479,9 +480,11 @@ class RuleEvaluationService extends BaseService { async validateViaFormRuleAsyncInternal(form, entity, entityContext, entityName) { try { let ruleServiceLibraryInterfaceForSharingModules = this.getRuleServiceLibraryInterfaceForSharingModules(); + const authService = this.context.getService(AuthService); + const authToken = await authService.getAuthProviderService().getAuthToken(); const ruleFunc = eval(form.validationRule); return ruleFunc({ - params: _.merge({entity, entityContext, services: this.services}, this.getCommonParams()), + params: _.merge({entity, entityContext, services: this.services, authToken: authToken}, this.getCommonParams()), imports: getImports() }); } catch (e) {