From c211e9f8cfee42a82c634e722058a3723842b473 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 29 May 2014 10:38:52 -0400 Subject: [PATCH] Support AUTHENTICATED authorization for Ticket responsible selections --- .../com/gitblit/wicket/pages/EditTicketPage.java | 8 +++++--- .../java/com/gitblit/wicket/pages/TicketPage.java | 14 +++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java index 46781faf..fd5fc607 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java @@ -37,6 +37,7 @@ import org.eclipse.jgit.lib.Repository; import com.gitblit.Constants; import com.gitblit.Constants.AccessPermission; +import com.gitblit.Constants.AuthorizationControl; import com.gitblit.models.RegistrantAccessPermission; import com.gitblit.models.TicketModel; import com.gitblit.models.TicketModel.Change; @@ -163,11 +164,12 @@ public class EditTicketPage extends RepositoryPage { // responsible Set userlist = new TreeSet(ticket.getParticipants()); - if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) { - // anonymous push + if (UserModel.ANONYMOUS.canPush(getRepositoryModel()) + || AuthorizationControl.AUTHENTICATED == getRepositoryModel().authorizationControl) { + // authorization is ANONYMOUS or AUTHENTICATED (i.e. all users can be set responsible) userlist.addAll(app().users().getAllUsernames()); } else { - // authenticated push + // authorization is by NAMED users (users with PUSH permission can be set responsible) for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { userlist.add(rp.registrant); diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 659acad0..5d51ad18 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -57,6 +57,7 @@ import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.Constants; import com.gitblit.Constants.AccessPermission; +import com.gitblit.Constants.AuthorizationControl; import com.gitblit.Keys; import com.gitblit.git.PatchsetCommand; import com.gitblit.git.PatchsetReceivePack; @@ -381,9 +382,16 @@ public class TicketPage extends TicketBasePage { * RESPONSIBLE LIST */ Set userlist = new TreeSet(ticket.getParticipants()); - for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { - if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { - userlist.add(rp.registrant); + if (UserModel.ANONYMOUS.canPush(getRepositoryModel()) + || AuthorizationControl.AUTHENTICATED == getRepositoryModel().authorizationControl) { + // authorization is ANONYMOUS or AUTHENTICATED (i.e. all users can be set responsible) + userlist.addAll(app().users().getAllUsernames()); + } else { + // authorization is by NAMED users (users with PUSH permission can be set responsible) + for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { + if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { + userlist.add(rp.registrant); + } } } List responsibles = new ArrayList(); -- 2.39.5