Skip to content

Commit 8ff23fa

Browse files
committed
fix permission check in convert function
1 parent 96d435c commit 8ff23fa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/convert/repository.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ func ToRepo(ctx context.Context, repo *repo_model.Repository, permissionInRepo a
2525
func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInRepo access_model.Permission, isParent bool) *api.Repository {
2626
var parent *api.Repository
2727

28-
if len(permissionInRepo.Units) == 0 && len(permissionInRepo.UnitsMode) == 0 {
29-
// If Units and UnitsMode are both nil, it means that it's a hard coded permission,
28+
if len(permissionInRepo.Units) == 0 {
29+
// If Units is both nil, it means that it's a hard coded permission, (TODO: maybe no such problem anymore, because we always load the units now)
3030
// like access_model.Permission{AccessMode: perm.AccessModeAdmin}.
31-
// So we need to load units for the repo, or UnitAccessMode will always return perm.AccessModeNone.
31+
// So we need to load units for the repo, otherwise UnitAccessMode will always return perm.AccessModeNone.
3232
_ = repo.LoadUnits(ctx) // the error is not important, so ignore it
3333
permissionInRepo.Units = repo.Units
3434
}

0 commit comments

Comments
 (0)