MCPcopy Index your code
hub / github.com/coder/coder / UpdateChatACLByID

Method UpdateChatACLByID

coderd/database/dbauthz/dbauthz.go:6573–6589  ·  view source on GitHub ↗
(ctx context.Context, arg database.UpdateChatACLByIDParams)

Source from the content-addressed store, hash-verified

6571}
6572
6573func (q *querier) UpdateChatACLByID(ctx context.Context, arg database.UpdateChatACLByIDParams) error {
6574 if rbac.ChatACLDisabled() {
6575 return NotAuthorizedError{Err: xerrors.New("chat sharing is disabled")}
6576 }
6577 fetch := func(ctx context.Context, arg database.UpdateChatACLByIDParams) (database.Chat, error) {
6578 chat, err := q.db.GetChatByID(ctx, arg.ID)
6579 if err != nil {
6580 return database.Chat{}, err
6581 }
6582 if chat.IsSubChat() {
6583 return database.Chat{}, NotAuthorizedError{Err: xerrors.New("chat ACLs can only be updated on root chats")}
6584 }
6585 return chat, nil
6586 }
6587
6588 return fetchAndExec(q.log, q.auth, policy.ActionShare, fetch, q.db.UpdateChatACLByID)(ctx, arg)
6589}
6590
6591func (q *querier) UpdateChatBuildAgentBinding(ctx context.Context, arg database.UpdateChatBuildAgentBindingParams) (database.Chat, error) {
6592 chat, err := q.db.GetChatByID(ctx, arg.ID)

Callers

nothing calls this directly

Calls 5

ChatACLDisabledFunction · 0.92
fetchAndExecFunction · 0.85
IsSubChatMethod · 0.80
NewMethod · 0.65
GetChatByIDMethod · 0.65

Tested by

no test coverage detected