@@ -87,7 +87,7 @@ export const PromptVariantResponseListService = <
87
87
session : Session ,
88
88
) : Promise < PromptVariantResponseList < TVariant > > {
89
89
const context = parent as any ;
90
- const edge = this . repo . edge . forUser ( session , context ) ;
90
+ const edge = this . repo . edge . forContext ( context ) ;
91
91
const canRead = edge . can ( 'read' ) ;
92
92
if ( ! canRead ) {
93
93
return {
@@ -97,7 +97,7 @@ export const PromptVariantResponseListService = <
97
97
}
98
98
const results = await this . repo . list ( parent . id , session ) ;
99
99
100
- const privileges = this . resourcePrivileges . forUser ( session , context ) ;
100
+ const privileges = this . resourcePrivileges . forContext ( context ) ;
101
101
102
102
const [ secured , prompts , variants ] = await Promise . all ( [
103
103
mapListResults ( results , async ( dto ) => await this . secure ( dto , session ) ) ,
@@ -130,7 +130,7 @@ export const PromptVariantResponseListService = <
130
130
session : Session ,
131
131
) : Promise < PromptVariantResponse < TVariant > > {
132
132
const context = await this . getPrivilegeContext ( dto ) ;
133
- const privileges = this . resourcePrivileges . forUser ( session , context ) ;
133
+ const privileges = this . resourcePrivileges . forContext ( context ) ;
134
134
const responses = mapKeys . fromList ( dto . responses , ( r ) => r . variant ) . asMap ;
135
135
const secured = privileges . secure ( dto ) ;
136
136
return {
@@ -174,8 +174,7 @@ export const PromptVariantResponseListService = <
174
174
edge . resource ,
175
175
input . resource ,
176
176
) ;
177
- const privileges = edge . forUser (
178
- session ,
177
+ const privileges = edge . forContext (
179
178
// @ts -expect-error yeah it's not unsecured, but none of our conditions actually needs that.
180
179
parent ,
181
180
) ;
@@ -194,7 +193,7 @@ export const PromptVariantResponseListService = <
194
193
) : Promise < PromptVariantResponse < TVariant > > {
195
194
const response = await this . repo . readOne ( input . id , session ) ;
196
195
const context = await this . getPrivilegeContext ( response ) ;
197
- const privileges = this . resourcePrivileges . forUser ( session , context ) ;
196
+ const privileges = this . resourcePrivileges . forContext ( context ) ;
198
197
privileges . verifyCan ( 'edit' , 'prompt' ) ;
199
198
200
199
await this . getPromptById ( input . prompt ) ;
@@ -214,7 +213,7 @@ export const PromptVariantResponseListService = <
214
213
215
214
const response = await this . repo . readOne ( input . id , session ) ;
216
215
const context = await this . getPrivilegeContext ( response ) ;
217
- const privileges = this . resourcePrivileges . forUser ( session , context ) ;
216
+ const privileges = this . resourcePrivileges . forContext ( context ) ;
218
217
219
218
const perm = privileges
220
219
. forContext ( withVariant ( privileges . context ! , variant . key ) )
@@ -261,7 +260,7 @@ export const PromptVariantResponseListService = <
261
260
const response = await this . repo . readOne ( id , session ) ;
262
261
263
262
const context = await this . getPrivilegeContext ( response ) ;
264
- const privileges = this . resourcePrivileges . forUser ( session , context ) ;
263
+ const privileges = this . resourcePrivileges . forContext ( context ) ;
265
264
privileges . verifyCan ( 'delete' ) ;
266
265
267
266
await this . repo . deleteNode ( id ) ;
0 commit comments