Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b0bedc

Browse files
committed
s/session/interception
1 parent1afc6f5 commit9b0bedc

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,18 @@ func (q *querier) authorizePrebuiltWorkspace(ctx context.Context, action policy.
177177

178178
// authorizeAIBridgeInterceptionUpdate validates that the context's actor matches the initiator of the AIBridgeInterception.
179179
// 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 {
181181
act,ok:=ActorFromContext(ctx)
182182
if!ok {
183183
returnErrNoActor
184184
}
185185

186-
sess,err:=q.db.GetAIBridgeInterceptionByID(ctx,sessID)
186+
inter,err:=q.db.GetAIBridgeInterceptionByID(ctx,interceptionID)
187187
iferr!=nil {
188-
returnxerrors.Errorf("fetch aibridgesession %q: %w",sessID,err)
188+
returnxerrors.Errorf("fetch aibridgeinterception %q: %w",interceptionID,err)
189189
}
190190

191-
err=q.auth.Authorize(ctx,act,policy.ActionUpdate,sess.RBACObject())
191+
err=q.auth.Authorize(ctx,act,policy.ActionUpdate,inter.RBACObject())
192192
iferr!=nil {
193193
returnlogNotAuthorizedError(ctx,q.log,err)
194194
}
@@ -3816,23 +3816,23 @@ func (q *querier) InsertAIBridgeInterception(ctx context.Context, arg database.I
38163816
}
38173817

38183818
func (q*querier)InsertAIBridgeTokenUsage(ctx context.Context,arg database.InsertAIBridgeTokenUsageParams)error {
3819-
// All aibridge_token_usages records belong to the initiator of their associatedsession.
3819+
// All aibridge_token_usages records belong to the initiator of their associatedinterception.
38203820
iferr:=q.authorizeAIBridgeInterceptionUpdate(ctx,arg.InterceptionID);err!=nil {
38213821
returnerr
38223822
}
38233823
returnq.db.InsertAIBridgeTokenUsage(ctx,arg)
38243824
}
38253825

38263826
func (q*querier)InsertAIBridgeToolUsage(ctx context.Context,arg database.InsertAIBridgeToolUsageParams)error {
3827-
// All aibridge_tool_usages records belong to the initiator of their associatedsession.
3827+
// All aibridge_tool_usages records belong to the initiator of their associatedinterception.
38283828
iferr:=q.authorizeAIBridgeInterceptionUpdate(ctx,arg.InterceptionID);err!=nil {
38293829
returnerr
38303830
}
38313831
returnq.db.InsertAIBridgeToolUsage(ctx,arg)
38323832
}
38333833

38343834
func (q*querier)InsertAIBridgeUserPrompt(ctx context.Context,arg database.InsertAIBridgeUserPromptParams)error {
3835-
// All aibridge_user_prompts records belong to the initiator of their associatedsession.
3835+
// All aibridge_user_prompts records belong to the initiator of their associatedinterception.
38363836
iferr:=q.authorizeAIBridgeInterceptionUpdate(ctx,arg.InterceptionID);err!=nil {
38373837
returnerr
38383838
}

‎coderd/rbac/roles_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,8 @@ func TestRolePermissions(t *testing.T) {
893893
Actions: []policy.Action{policy.ActionCreate,policy.ActionRead,policy.ActionUpdate},
894894
Resource:rbac.ResourceAibridgeInterception,
895895
AuthorizeMap:map[bool][]hasAuthSubjects{
896-
true: {},
896+
true: {owner},
897897
false: {
898-
owner,
899898
memberMe,orgMemberMe,otherOrgMember,
900899
orgAdmin,otherOrgAdmin,
901900
orgAuditor,otherOrgAuditor,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp