From f9d6ef0621e22f50754328cdd17013ab1d7c7346 Mon Sep 17 00:00:00 2001 From: Kristina Date: Mon, 31 Mar 2025 10:58:51 +0400 Subject: [PATCH] Add exception to rules for ai bot in identity (#8398) Signed-off-by: Kristina Fefelova --- server/middleware/package.json | 1 + server/middleware/src/identity.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/middleware/package.json b/server/middleware/package.json index 748417a56d..92054c9a27 100644 --- a/server/middleware/package.json +++ b/server/middleware/package.json @@ -37,6 +37,7 @@ "@types/jest": "^29.5.5" }, "dependencies": { + "@hcengineering/ai-bot": "^0.6.0", "@hcengineering/core": "^0.6.32", "@hcengineering/platform": "^0.6.11", "@hcengineering/server-core": "^0.6.1", diff --git a/server/middleware/src/identity.ts b/server/middleware/src/identity.ts index 0456084ed4..a8b46bc48c 100644 --- a/server/middleware/src/identity.ts +++ b/server/middleware/src/identity.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // +import { aiBotAccountEmail } from '@hcengineering/ai-bot' import core, { MeasureContext, Tx, systemAccountEmail, type SessionData, type TxApplyIf } from '@hcengineering/core' import platform, { PlatformError, Severity, Status } from '@hcengineering/platform' import { BaseMiddleware, Middleware, TxMiddlewareResult, type PipelineContext } from '@hcengineering/server-core' @@ -34,7 +35,7 @@ export class IdentityMiddleware extends BaseMiddleware implements Middleware { tx (ctx: MeasureContext, txes: Tx[]): Promise { const account = ctx.contextData.account - if (account.email === systemAccountEmail) { + if (account.email === systemAccountEmail || account.email === aiBotAccountEmail) { // TODO: We need to enhance allowed list in case of user service, on behalf of user activities. // We pass for system accounts and services.