]> source.dussan.org Git - gitblit.git/commitdiff
Allow ticket responsible selection when anonymous push is enabled 71/71/1
authorJames Moger <james.moger@gitblit.com>
Mon, 12 May 2014 12:46:29 +0000 (08:46 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 12 May 2014 12:46:29 +0000 (08:46 -0400)
src/main/java/com/gitblit/wicket/pages/EditTicketPage.java
src/main/java/com/gitblit/wicket/pages/NewTicketPage.java

index c3294ba29db2a43c76946ab1ba7f9216ffbdc984..46781faf0ea6d956f656858976e960e185f6685a 100644 (file)
@@ -163,16 +163,22 @@ public class EditTicketPage extends RepositoryPage {
                        // responsible\r
                        Set<String> userlist = new TreeSet<String>(ticket.getParticipants());\r
 \r
-                       for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {\r
-                               if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {\r
-                                       userlist.add(rp.registrant);\r
+                       if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) {\r
+                               // anonymous push\r
+                               userlist.addAll(app().users().getAllUsernames());\r
+                       } else {\r
+                               // authenticated push\r
+                               for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {\r
+                                       if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {\r
+                                               userlist.add(rp.registrant);\r
+                                       }\r
                                }\r
                        }\r
 \r
                        List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();\r
                        for (String username : userlist) {\r
                                UserModel user = app().users().getUserModel(username);\r
-                               if (user != null) {\r
+                               if (user != null && !user.disabled) {\r
                                        TicketResponsible responsible = new TicketResponsible(user);\r
                                        responsibles.add(responsible);\r
                                        if (user.username.equals(ticket.responsible)) {\r
index cc0474a2926389fcbfe3860d1eedc45261aa5ff0..961590a298a14e8730e1ffb6c3fdfb15ec890f9b 100644 (file)
@@ -116,13 +116,23 @@ public class NewTicketPage extends RepositoryPage {
                if (currentUser.canAdmin(null, getRepositoryModel())) {\r
                        // responsible\r
                        List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();\r
-                       for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {\r
-                               if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {\r
-                                       UserModel user = app().users().getUserModel(rp.registrant);\r
-                                       if (user != null) {\r
+                       if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) {\r
+                               // anonymous push allowed\r
+                               for (UserModel user : app().users().getAllUsers()) {\r
+                                       if (!user.disabled) {\r
                                                responsibles.add(new TicketResponsible(user));\r
                                        }\r
                                }\r
+                       } else {\r
+                               // authenticated push\r
+                               for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {\r
+                                       if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {\r
+                                               UserModel user = app().users().getUserModel(rp.registrant);\r
+                                               if (user != null && !user.disabled) {\r
+                                                       responsibles.add(new TicketResponsible(user));\r
+                                               }\r
+                                       }\r
+                               }\r
                        }\r
                        Collections.sort(responsibles);\r
                        Fragment responsible = new Fragment("responsible", "responsibleFragment", this);\r