@@ -177,18 +177,18 @@ func (q *querier) authorizePrebuiltWorkspace(ctx context.Context, action policy.
177
177
178
178
// authorizeAIBridgeInterceptionUpdate validates that the context's actor matches the initiator of the AIBridgeInterception.
179
179
// This is used by all of the sub-resources which fall under the [ResourceAibridgeInterception] umbrella.
180
- func (q * querier ) authorizeAIBridgeInterceptionUpdate (ctx context.Context , sessID uuid.UUID ) error {
180
+ func (q * querier ) authorizeAIBridgeInterceptionUpdate (ctx context.Context , interceptionID uuid.UUID ) error {
181
181
act , ok := ActorFromContext (ctx )
182
182
if ! ok {
183
183
return ErrNoActor
184
184
}
185
185
186
- sess , err := q .db .GetAIBridgeInterceptionByID (ctx , sessID )
186
+ inter , err := q .db .GetAIBridgeInterceptionByID (ctx , interceptionID )
187
187
if err != nil {
188
- return xerrors .Errorf ("fetch aibridge session %q: %w" , sessID , err )
188
+ return xerrors .Errorf ("fetch aibridge interception %q: %w" , interceptionID , err )
189
189
}
190
190
191
- err = q .auth .Authorize (ctx , act , policy .ActionUpdate , sess .RBACObject ())
191
+ err = q .auth .Authorize (ctx , act , policy .ActionUpdate , inter .RBACObject ())
192
192
if err != nil {
193
193
return logNotAuthorizedError (ctx , q .log , err )
194
194
}
@@ -3816,23 +3816,23 @@ func (q *querier) InsertAIBridgeInterception(ctx context.Context, arg database.I
3816
3816
}
3817
3817
3818
3818
func (q * querier ) InsertAIBridgeTokenUsage (ctx context.Context , arg database.InsertAIBridgeTokenUsageParams ) error {
3819
- // All aibridge_token_usages records belong to the initiator of their associated session .
3819
+ // All aibridge_token_usages records belong to the initiator of their associated interception .
3820
3820
if err := q .authorizeAIBridgeInterceptionUpdate (ctx , arg .InterceptionID ); err != nil {
3821
3821
return err
3822
3822
}
3823
3823
return q .db .InsertAIBridgeTokenUsage (ctx , arg )
3824
3824
}
3825
3825
3826
3826
func (q * querier ) InsertAIBridgeToolUsage (ctx context.Context , arg database.InsertAIBridgeToolUsageParams ) error {
3827
- // All aibridge_tool_usages records belong to the initiator of their associated session .
3827
+ // All aibridge_tool_usages records belong to the initiator of their associated interception .
3828
3828
if err := q .authorizeAIBridgeInterceptionUpdate (ctx , arg .InterceptionID ); err != nil {
3829
3829
return err
3830
3830
}
3831
3831
return q .db .InsertAIBridgeToolUsage (ctx , arg )
3832
3832
}
3833
3833
3834
3834
func (q * querier ) InsertAIBridgeUserPrompt (ctx context.Context , arg database.InsertAIBridgeUserPromptParams ) error {
3835
- // All aibridge_user_prompts records belong to the initiator of their associated session .
3835
+ // All aibridge_user_prompts records belong to the initiator of their associated interception .
3836
3836
if err := q .authorizeAIBridgeInterceptionUpdate (ctx , arg .InterceptionID ); err != nil {
3837
3837
return err
3838
3838
}
0 commit comments