(ctx context.Context, namespace, name, currentUser string)
| 547 | } |
| 548 | |
| 549 | func (c *ModelComponent) Relations(ctx context.Context, namespace, name, currentUser string) (*types.Relations, error) { |
| 550 | model, err := c.ms.FindByPath(ctx, namespace, name) |
| 551 | if err != nil { |
| 552 | return nil, fmt.Errorf("failed to find model, error: %w", err) |
| 553 | } |
| 554 | |
| 555 | allow, _ := c.AllowReadAccessRepo(ctx, model.Repository, currentUser) |
| 556 | if !allow { |
| 557 | return nil, ErrUnauthorized |
| 558 | } |
| 559 | |
| 560 | return c.getRelations(ctx, model.RepositoryID, currentUser) |
| 561 | } |
| 562 | |
| 563 | func (c *ModelComponent) getRelations(ctx context.Context, fromRepoID int64, currentUser string) (*types.Relations, error) { |
| 564 | res, err := c.relatedRepos(ctx, fromRepoID, currentUser) |
nothing calls this directly
no test coverage detected