(ctx context.Context, id int64, currentUser string)
| 89 | } |
| 90 | |
| 91 | func (c *MirrorSourceComponent) Delete(ctx context.Context, id int64, currentUser string) error { |
| 92 | user, err := c.userStore.FindByUsername(ctx, currentUser) |
| 93 | if err != nil { |
| 94 | return errors.New("user does not exist") |
| 95 | } |
| 96 | if !user.CanAdmin() { |
| 97 | return errors.New("user does not have admin permission") |
| 98 | } |
| 99 | ms, err := c.msStore.Get(ctx, id) |
| 100 | if err != nil { |
| 101 | return fmt.Errorf("failed to find mirror source, error: %w", err) |
| 102 | } |
| 103 | err = c.msStore.Delete(ctx, ms) |
| 104 | if err != nil { |
| 105 | return fmt.Errorf("failed to delete mirror source, error: %w", err) |
| 106 | } |
| 107 | return nil |
| 108 | } |
nothing calls this directly
no test coverage detected