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

Function userSkillContext

coderd/x/chatd/chatd.go:6833–6849  ·  view source on GitHub ↗
(ctx context.Context, userID uuid.UUID)

Source from the content-addressed store, hash-verified

6831}
6832
6833func userSkillContext(ctx context.Context, userID uuid.UUID) context.Context {
6834 actor := rbac.Subject{
6835 Type: rbac.SubjectTypeUser,
6836 ID: userID.String(),
6837 Roles: rbac.RoleIdentifiers{rbac.RoleMember()},
6838 Scope: rbac.ScopeAll,
6839 }.WithCachedASTValue()
6840 // Chat turns run asynchronously after admission, so the original request
6841 // actor may no longer be available when a worker loads personal skills.
6842 // We synthesize the chat owner as a member instead of reusing that actor.
6843 // Hardcoding RoleMember is safe because dbauthz enforces
6844 // ResourceUserSkill.WithOwner(userID), so this actor cannot read any other
6845 // user's skills regardless of role. Org scoping is not needed because
6846 // personal skills are user-scoped, not org-scoped.
6847 //nolint:gocritic // The synthetic actor is intentional for the reasons above.
6848 return dbauthz.As(ctx, actor)
6849}
6850
6851func (p *Server) fetchPersonalSkillMetadata(
6852 ctx context.Context,

Callers 2

loadPersonalSkillBodyMethod · 0.85

Calls 4

RoleMemberFunction · 0.92
AsFunction · 0.92
WithCachedASTValueMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected