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

Method GetFileByID

coderd/database/dbauthz/dbauthz.go:3450–3464  ·  view source on GitHub ↗
(ctx context.Context, id uuid.UUID)

Source from the content-addressed store, hash-verified

3448}
3449
3450func (q *querier) GetFileByID(ctx context.Context, id uuid.UUID) (database.File, error) {
3451 file, err := q.db.GetFileByID(ctx, id)
3452 if err != nil {
3453 return database.File{}, err
3454 }
3455 err = q.authorizeContext(ctx, policy.ActionRead, file)
3456 if err != nil {
3457 // Check the user's access to the file's templates.
3458 if q.authorizeUpdateFileTemplate(ctx, file) != nil {
3459 return database.File{}, err
3460 }
3461 }
3462
3463 return file, nil
3464}
3465
3466func (q *querier) GetFileTemplates(ctx context.Context, fileID uuid.UUID) ([]database.GetFileTemplatesRow, error) {
3467 if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {

Callers

nothing calls this directly

Calls 3

authorizeContextMethod · 0.95
GetFileByIDMethod · 0.65

Tested by

no test coverage detected