@@ -42,13 +42,14 @@ import {
4242import { SqlDriver } from '@objectstack/driver-sql' ;
4343import { SysUser } from '@objectstack/platform-objects' ;
4444import { resolveDisplayField , resolveRecordDisplayName } from '@objectstack/spec/data' ;
45+ import type { ExecutionContext } from '@objectstack/spec/kernel' ;
4546import { SysUserPermissionSet } from './sys-user-permission-set.object.js' ;
4647
4748const SYS = { context : { isSystem : true } } as any ;
4849const OBJECT = 'sys_user_permission_set' ;
4950
5051/** A reader who is not SYSTEM: the shape every request's context has. */
51- const READER = { userId : 'usr_reader' , tenantId : 'org_1' } ;
52+ const READER : ExecutionContext = { userId : 'usr_reader' , tenantId : 'org_1' } ;
5253
5354/** Every `record.<path>` the `display_title` expression reads, as written. */
5455function formulaReads ( ) : string [ ] {
@@ -152,17 +153,17 @@ describe('sys_user_permission_set is titled by the person, not the raw user id',
152153 const bob = await user ( 'Bob Kinney' , 'bob@example.com' ) ;
153154 const g = await grant ( bob ) ;
154155 readable . add ( bob ) ;
155- const row = await engine . findOne ( OBJECT , { where : { id : g . id } } , { context : READER } as any ) ;
156+ const row = await engine . findOne ( OBJECT , { where : { id : g . id } } , { context : READER } ) ;
156157 expect ( row ! . display_title ) . toBe ( 'Bob Kinney → crm_edit' ) ;
157158 } ) ;
158159
159160 it ( 'a user the reader may not read leaves the title null, and nothing of the user reaches the row' , async ( ) => {
160161 const carol = await user ( 'Carol Hidden' , 'carol.hidden@example.com' ) ;
161162 const g = await grant ( carol ) ;
162163 // The reader's own read of that user returns nothing…
163- expect ( await engine . find ( 'sys_user' , { where : { id : carol } } , { context : READER } as any ) ) . toEqual ( [ ] ) ;
164+ expect ( await engine . find ( 'sys_user' , { where : { id : carol } } , { context : READER } ) ) . toEqual ( [ ] ) ;
164165 // …so the title over it has no value, and neither the name nor the email leaks.
165- const row = await engine . findOne ( OBJECT , { where : { id : g . id } } , { context : READER } as any ) ;
166+ const row = await engine . findOne ( OBJECT , { where : { id : g . id } } , { context : READER } ) ;
166167 expect ( row ! . display_title ) . toBeNull ( ) ;
167168 expect ( JSON . stringify ( row ) ) . not . toContain ( 'Carol Hidden' ) ;
168169 expect ( JSON . stringify ( row ) ) . not . toContain ( 'carol.hidden@example.com' ) ;
0 commit comments