fix: apply permissions when flatPermissions enabled (#1603)

Closes #1582 

When `WOODPECKER_FLAT_PERMISSIONS=true` workaround is applied all
permissions are set to false (default) and query never returns any
matches.

This fixes it by always assigning Pull/Push/Admin to true when flatPermissions is enabled.
This commit is contained in:
Hayden 2023-03-13 18:42:11 -08:00 committed by GitHub
parent ee969979c6
commit c60c59bd65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,11 +78,9 @@ func (s *Syncer) Sync(ctx context.Context, user *model.User, flatPermissions boo
// TODO(485) temporary workaround to not hit api rate limits
if flatPermissions {
if repo.Perm == nil {
repo.Perm.Pull = true
repo.Perm.Push = true
repo.Perm.Admin = true
}
repo.Perm.Pull = true
repo.Perm.Push = true
repo.Perm.Admin = true
} else {
forgePerm, err := s.Forge.Perm(ctx, user, repo)
if err != nil {