Skip to content

Commit

Permalink
Fix repo permission check bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pulltheflower committed Dec 10, 2024
1 parent 483fdb1 commit 0913a85
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions component/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1429,13 +1429,10 @@ func (c *repoComponentImpl) AllowReadAccess(ctx context.Context, repoType types.
}

func (c *repoComponentImpl) AllowWriteAccess(ctx context.Context, repoType types.RepositoryType, namespace, name, username string) (bool, error) {
repo, err := c.repoStore.FindByPath(ctx, repoType, namespace, name)
_, err := c.repoStore.FindByPath(ctx, repoType, namespace, name)
if err != nil {
return false, fmt.Errorf("failed to find repo, error: %w", err)
}
if !repo.Private {
return true, nil
}

if username == "" {
return false, ErrUserNotFound
Expand All @@ -1445,13 +1442,10 @@ func (c *repoComponentImpl) AllowWriteAccess(ctx context.Context, repoType types
}

func (c *repoComponentImpl) AllowAdminAccess(ctx context.Context, repoType types.RepositoryType, namespace, name, username string) (bool, error) {
repo, err := c.repoStore.FindByPath(ctx, repoType, namespace, name)
_, err := c.repoStore.FindByPath(ctx, repoType, namespace, name)
if err != nil {
return false, fmt.Errorf("failed to find repo, error: %w", err)
}
if !repo.Private {
return true, nil
}

if username == "" {
return false, ErrUserNotFound
Expand Down

0 comments on commit 0913a85

Please sign in to comment.