import java.util.Arrays;\r
import java.util.Collections;\r
import java.util.List;\r
+import java.util.Set;\r
+import java.util.TreeSet;\r
\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.ajax.AjaxRequestTarget;\r
\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
\r
if (currentUser.canAdmin(null, getRepositoryModel())) {\r
// responsible\r
- List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();\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
+ Set<String> userlist = new TreeSet<String>();\r
+\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
- UserModel user = app().users().getUserModel(rp.registrant);\r
- if (user != null && !user.disabled) {\r
- responsibles.add(new TicketResponsible(user));\r
- }\r
+ if (rp.permission.atLeast(AccessPermission.PUSH)) {\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 && !user.disabled) {\r
+ TicketResponsible responsible = new TicketResponsible(user);\r
+ responsibles.add(responsible);\r
+ }\r
+ }\r
Collections.sort(responsibles);\r
Fragment responsible = new Fragment("responsible", "responsibleFragment", this);\r
responsible.add(new DropDownChoice<TicketResponsible>("responsible", responsibleModel, responsibles));\r