You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportasyncfunctionbeforeUpdate(ctx: any){constok=awaitctx.services?.sharing?.canEdit('contract',ctx.input.id,{userId: ctx.session?.userId,// Read the caller's org under `organizationId` (the `session.tenantId` alias// was removed in v11, #3290); it feeds the sharing context's `tenantId`.tenantId: ctx.session?.organizationId,positions: ctx.session?.positions,});if(!ok){thrownewError('PERMISSION_DENIED');}}
3) Plugin: subscribe to kernel lifecycle events
importtype{Plugin}from'@objectstack/core';exportconstExamplePlugin: Plugin={name: 'example-plugin',asyncinit(ctx){ctx.hook('kernel:ready',async()=>{ctx.logger.info('Kernel ready, initializing subscriptions');});ctx.hook('kernel:shutdown',async()=>{ctx.logger.info('Shutdown signal received, cleaning up');});},};