From: James Moger Date: Mon, 12 May 2014 12:46:29 +0000 (-0400) Subject: Allow ticket responsible selection when anonymous push is enabled X-Git-Tag: v1.6.0~71^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Ftickets%2F71%2F71%2F1;p=gitblit.git Allow ticket responsible selection when anonymous push is enabled --- 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);