Skip to content

Commit 5a5751a

Browse files
committed
Fix: allow users to create app from public repo
1 parent 814d9d8 commit 5a5751a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/usecase/apiserver/app_service.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ func (s *Service) validateApp(ctx context.Context, app *domain.Application) erro
5050
}
5151

5252
func (s *Service) CreateApplication(ctx context.Context, app *domain.Application) (*domain.Application, error) {
53-
err := s.isRepositoryOwner(ctx, app.RepositoryID)
54-
if err != nil {
55-
return nil, err
56-
}
57-
5853
// Fill owners field
5954
repo, err := s.gitRepo.GetRepository(ctx, app.RepositoryID)
6055
if err != nil {
@@ -65,7 +60,11 @@ func (s *Service) CreateApplication(ctx context.Context, app *domain.Application
6560
for _, website := range app.Websites {
6661
website.Normalize()
6762
}
63+
6864
// Validate
65+
if !repo.CanCreateApp(web.GetUser(ctx)) {
66+
return nil, newError(ErrorTypeForbidden, "you cannot create application from this repository", nil)
67+
}
6968
err = s.validateApp(ctx, app)
7069
if err != nil {
7170
return nil, err

0 commit comments

Comments
 (0)