Skip to content

Commit

Permalink
Address the comment from @jrhee17
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Dec 23, 2024
1 parent 75da118 commit 64a00ab
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -903,28 +903,31 @@ private CompletableFuture<RepositoryRole> findRepositoryRole0(String projectName
@Nullable
private static RepositoryRole repositoryRole(Roles roles, @Nullable RepositoryRole repositoryRole,
ProjectRole projectRole) {
if (repositoryRole == RepositoryRole.ADMIN || projectRole == ProjectRole.OWNER) {
if (projectRole == ProjectRole.OWNER) {
return RepositoryRole.ADMIN;
}

final RepositoryRole memberOrGuestRole;
if (projectRole == ProjectRole.MEMBER) {
memberOrGuestRole = roles.projectRoles().member();
} else {
assert projectRole == ProjectRole.GUEST;
memberOrGuestRole = roles.projectRoles().guest();
}

if (repositoryRole == null) {
return memberOrGuestRole;
}
if (memberOrGuestRole == null) {
return repositoryRole;
if (repositoryRole == RepositoryRole.ADMIN || memberOrGuestRole == RepositoryRole.ADMIN) {
return RepositoryRole.ADMIN;
}
if (memberOrGuestRole == RepositoryRole.WRITE || repositoryRole == RepositoryRole.WRITE) {

if (repositoryRole == RepositoryRole.WRITE || memberOrGuestRole == RepositoryRole.WRITE) {
return RepositoryRole.WRITE;
}

return RepositoryRole.READ;
if (repositoryRole == RepositoryRole.READ || memberOrGuestRole == RepositoryRole.READ) {
return RepositoryRole.READ;
}

return null;
}

/**
Expand Down

0 comments on commit 64a00ab

Please sign in to comment.