mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
refactor(mcp): the demo-mode write block runs once, in the registry's tool gate
Every write tool used to open with its own demo check, 196 copies across 30 tool files, most of them injecting AuthService for nothing else. The registry now takes a toolGate (built from the container) that runs before each registered tool handler, and TREK's gate refuses a demo account on every tool not annotated read-only with the same canned result. The per-tool checks, the AuthService injections, AuthService.isDemoUser and the AuthModule imports that only fed them are gone; ESLint refuses a demo check in a tool file, and a registry-wide test calls every write tool as the demo account.
This commit is contained in:
@@ -2,7 +2,6 @@ import { Module } from '@nestjs/common';
|
||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||
import { AddonsModule } from '../addons/addons.module';
|
||||
import { AuditModule } from '../audit/audit.module';
|
||||
import { AuthModule } from '../auth/auth.module';
|
||||
import { AtlasModule } from '../atlas/atlas.module';
|
||||
import { PermissionsModule } from '../permissions/permissions.module';
|
||||
import { PlacesModule } from '../places/places.module';
|
||||
@@ -61,7 +60,7 @@ import { DawarichTracksService } from './dawarich-tracks.service';
|
||||
AuditModule,
|
||||
// The MCP tools ask AuthService whether the caller is the demo user, the
|
||||
// same gate every other write tool carries.
|
||||
AuthModule,
|
||||
|
||||
AtlasModule,
|
||||
// Accepting a stay writes a place and a day assignment, so it asks the same
|
||||
// permissions the planner asks before doing either.
|
||||
|
||||
Reference in New Issue
Block a user