]> source.dussan.org Git - gitblit.git/commitdiff
Support AUTHENTICATED authorization for Ticket responsible selections 91/91/1
authorJames Moger <james.moger@gitblit.com>
Thu, 29 May 2014 14:38:52 +0000 (10:38 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 29 May 2014 14:38:52 +0000 (10:38 -0400)
src/main/java/com/gitblit/wicket/pages/EditTicketPage.java
src/main/java/com/gitblit/wicket/pages/TicketPage.java

index 46781faf0ea6d956f656858976e960e185f6685a..fd5fc607a4a24f1a6fb97272a30ab8d98bc592cd 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.jgit.lib.Repository;
 \r
 import com.gitblit.Constants;\r
 import com.gitblit.Constants.AccessPermission;\r
+import com.gitblit.Constants.AuthorizationControl;\r
 import com.gitblit.models.RegistrantAccessPermission;\r
 import com.gitblit.models.TicketModel;\r
 import com.gitblit.models.TicketModel.Change;\r
@@ -163,11 +164,12 @@ public class EditTicketPage extends RepositoryPage {
                        // responsible\r
                        Set<String> userlist = new TreeSet<String>(ticket.getParticipants());\r
 \r
-                       if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) {\r
-                               // anonymous push\r
+                       if (UserModel.ANONYMOUS.canPush(getRepositoryModel())\r
+                                       || AuthorizationControl.AUTHENTICATED == getRepositoryModel().authorizationControl) {\r
+                               //      authorization is ANONYMOUS or AUTHENTICATED (i.e. all users can be set responsible)\r
                                userlist.addAll(app().users().getAllUsernames());\r
                        } else {\r
-                               // authenticated push\r
+                               // authorization is by NAMED users (users with PUSH permission can be set responsible)\r
                                for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {\r
                                        if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {\r
                                                userlist.add(rp.registrant);\r
index 659acad06e406a5aafdfb8ea4cdddd11e10a9ee0..5d51ad187056bd3a3e7711a313f06c3e14c3fb43 100644 (file)
@@ -57,6 +57,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
 \r
 import com.gitblit.Constants;\r
 import com.gitblit.Constants.AccessPermission;\r
+import com.gitblit.Constants.AuthorizationControl;\r
 import com.gitblit.Keys;\r
 import com.gitblit.git.PatchsetCommand;\r
 import com.gitblit.git.PatchsetReceivePack;\r
@@ -381,9 +382,16 @@ public class TicketPage extends TicketBasePage {
                                 * RESPONSIBLE LIST\r
                                 */\r
                                Set<String> userlist = new TreeSet<String>(ticket.getParticipants());\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
+                                               || AuthorizationControl.AUTHENTICATED == getRepositoryModel().authorizationControl) {\r
+                                       //      authorization is ANONYMOUS or AUTHENTICATED (i.e. all users can be set responsible)\r
+                                       userlist.addAll(app().users().getAllUsernames());\r
+                               } else {\r
+                                       // authorization is by NAMED users (users with PUSH permission can be set responsible)\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
                                List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();\r