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

Commit9f75609

Browse files
authored
Apply suggestions from code review
1 parent8b18611 commit9f75609

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,15 @@ func (q *querier) authorizePrebuiltWorkspace(ctx context.Context, action policy.
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.
180180
func (q*querier)authorizeAIBridgeInterceptionUpdate(ctx context.Context,interceptionID uuid.UUID)error {
181-
act,ok:=ActorFromContext(ctx)
182-
if!ok {
183-
returnErrNoActor
184-
}
185181

186182
inter,err:=q.db.GetAIBridgeInterceptionByID(ctx,interceptionID)
187183
iferr!=nil {
188184
returnxerrors.Errorf("fetch aibridge interception %q: %w",interceptionID,err)
189185
}
190186

191-
err=q.auth.Authorize(ctx,act,policy.ActionUpdate,inter.RBACObject())
192-
iferr!=nil {
193-
returnlogNotAuthorizedError(ctx,q.log,err)
187+
err=q.authorizeContext(ctx,policy.ActionUpdate,inter.RBACObject())
188+
iferr!=nil {
189+
returnerr
194190
}
195191

196192
returnnil

‎coderd/rbac/roles_test.go‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -888,20 +888,20 @@ func TestRolePermissions(t *testing.T) {
888888
},
889889
},
890890
},
891-
{
892-
Name:"AIBridgeInterceptions",
893-
Actions: []policy.Action{policy.ActionCreate,policy.ActionRead,policy.ActionUpdate},
894-
Resource:rbac.ResourceAibridgeInterception,
895-
AuthorizeMap:map[bool][]hasAuthSubjects{
896-
true: {owner},
897-
false: {
898-
memberMe,orgMemberMe,otherOrgMember,
899-
orgAdmin,otherOrgAdmin,
900-
orgAuditor,otherOrgAuditor,
901-
templateAdmin,orgTemplateAdmin,otherOrgTemplateAdmin,
902-
userAdmin,orgUserAdmin,otherOrgUserAdmin,
903-
},
904-
},
891+
{
892+
Name:"AIBridgeInterceptions",
893+
Actions: []policy.Action{policy.ActionCreate,policy.ActionRead,policy.ActionUpdate},
894+
Resource:rbac.ResourceAibridgeInterception.WithOwner(currentUser.String()),
895+
AuthorizeMap:map[bool][]hasAuthSubjects{
896+
true: {owner,memberMe,orgMemberMe},
897+
false: {
898+
otherOrgMember,
899+
orgAdmin,otherOrgAdmin,
900+
orgAuditor,otherOrgAuditor,
901+
templateAdmin,orgTemplateAdmin,otherOrgTemplateAdmin,
902+
userAdmin,orgUserAdmin,otherOrgUserAdmin,
903+
},
904+
},
905905
},
906906
}
907907

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp