summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-09-08 15:25:47 -0400
committerJames Moger <james.moger@gitblit.com>2014-09-08 15:25:47 -0400
commit0476cf68aa60ac0f8b77f5f75de8339d46a98688 (patch)
tree5e9b6b7c795ae62cd8f24c386c0ff753f18755d0 /src/main
parenteef3454015772e341beb069db959ceb0720a5e24 (diff)
downloadgitblit-0476cf68aa60ac0f8b77f5f75de8339d46a98688.tar.gz
gitblit-0476cf68aa60ac0f8b77f5f75de8339d46a98688.zip
Include all users with RW access in New Ticket responsible choices
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/NewTicketPage.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java b/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java
index 7a68febb..21a2af10 100644
--- a/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/NewTicketPage.java
@@ -19,6 +19,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -35,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;
@@ -117,25 +120,29 @@ public class NewTicketPage extends RepositoryPage {
if (currentUser.canAdmin(null, getRepositoryModel())) {
// responsible
- List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();
- if (UserModel.ANONYMOUS.canPush(getRepositoryModel())) {
- // anonymous push allowed
- for (UserModel user : app().users().getAllUsers()) {
- if (!user.disabled) {
- responsibles.add(new TicketResponsible(user));
- }
- }
+ Set<String> userlist = new TreeSet<String>();
+
+ 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()) {
- UserModel user = app().users().getUserModel(rp.registrant);
- if (user != null && !user.disabled) {
- responsibles.add(new TicketResponsible(user));
- }
+ if (rp.permission.atLeast(AccessPermission.PUSH)) {
+ userlist.add(rp.registrant);
}
}
}
+
+ List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();
+ for (String username : userlist) {
+ UserModel user = app().users().getUserModel(username);
+ if (user != null && !user.disabled) {
+ TicketResponsible responsible = new TicketResponsible(user);
+ responsibles.add(responsible);
+ }
+ }
Collections.sort(responsibles);
Fragment responsible = new Fragment("responsible", "responsibleFragment", this);
responsible.add(new DropDownChoice<TicketResponsible>("responsible", responsibleModel, responsibles));