From eb61292adce83ee88561fb7df3fb2ddf2d34a282 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 12 May 2014 08:46:29 -0400 Subject: [PATCH] Allow ticket responsible selection when anonymous push is enabled --- .../gitblit/wicket/pages/EditTicketPage.java | 14 ++++++++++---- .../gitblit/wicket/pages/NewTicketPage.java | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java index c3294ba2..46781faf 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java @@ -163,16 +163,22 @@ public class EditTicketPage extends RepositoryPage { // responsible 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())) { + // anonymous push + userlist.addAll(app().users().getAllUsernames()); + } else { + // authenticated push + for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { + if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { + userlist.add(rp.registrant); + } } } List responsibles = new ArrayList(); for (String username : userlist) { UserModel user = app().users().getUserModel(username); - if (user != null) { + if (user != null && !user.disabled) { TicketResponsible responsible = new TicketResponsible(user); responsibles.add(responsible); if (user.username.equals(ticket.responsible)) { diff --git a/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java b/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java index cc0474a2..961590a2 100644 --- a/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java @@ -116,13 +116,23 @@ public class NewTicketPage extends RepositoryPage { if (currentUser.canAdmin(null, getRepositoryModel())) { // responsible List responsibles = new ArrayList(); - for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { - if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { - UserModel user = app().users().getUserModel(rp.registrant); - if (user != null) { + if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) { + // anonymous push allowed + for (UserModel user : app().users().getAllUsers()) { + if (!user.disabled) { responsibles.add(new TicketResponsible(user)); } } + } else { + // authenticated push + for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) { + if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) { + UserModel user = app().users().getUserModel(rp.registrant); + if (user != null && !user.disabled) { + responsibles.add(new TicketResponsible(user)); + } + } + } } Collections.sort(responsibles); Fragment responsible = new Fragment("responsible", "responsibleFragment", this); -- 2.39.5